Once you’ve created a model class, you may want to retrieve the list of the top 10 newest objects. How can you do that?
The answer lies in the find function (similar to find_all). It can take some additional parameters–notably, an order clause, and a limit.
So say you have an object called Article, and you want the most recent 10 articles. You can simply add this code to your controller:
@newestTen = Article.find :all, :order => "updated_on desc", :limit => 10
…and you get the ten most recent articles!
For more details on find, you can find (pun not intended) a reference here.