How to I retrieve the second, third .. entries in a database. I don't want to use the auto incrementing id generated by rails.
As I am deleting entries from my database, so the ID continues to increase.
So my DB would have
id : 210 (Even thought it's currently the first value)
id : 211 (Even thought it's currently the second value)
I know "Phone.first" will return the first how do I get the second.
Sub Question-
Destroy_all/delete_all –
only removes the item, Can I remove all entries from the DB and have the DB id's start from one without dropping the table. As I ran into problems.
Best Answer
Say you want the fourth user:
Concerning your second question,
destroy_all
should do the trick since it triggers all callbacks. Be sure to add:dependent => :destroy
in your relationships.