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 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