Guo Yangguang wrote:> hello:
> How do i find the newly created 10 users in the database?Now i only
> know the way:
> 1.users=User.find(:all,:order=>"created_at DESC,id")
> 2.then get the first 10 users from the array
> I think this way is not the best one for getting all the records
> everytime.
> Anyone can help me?
User.find :all, :order => ''created_at desc", :limit => 10
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---