If you want only the id of the last entered data then try this,
 User.maximum('id')
This will return the maximum id which will be anyways the last one.

Ishara Gunathilake wrote:
> can anyone tell me how can i get the last id(primary key) of the table

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to