If you are constantly using this order clause i recommend you create a
scope in your model.

scope :recent_games, order("created_at desc").limit(5)

then in your controller you call the scope like:

@var = Class.all.recent_games


2012/2/6 Christopher Jones <[email protected]>

> > Maybe you don't know about the limit clause?
>
> I had never previously heard of it but just done some research.
>
> Is this the sort of thing you mean?
>
> Game.find(:all, :limit => 5, :order=> 'created_at')
>
> ?
>
> Thanks
>
> --
> 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.
>
>

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