About find the newly created users

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?

Guo Y. 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs