What i do in that case is reverse my order (use ''id DESC'' for
instance) with a limit (limit 20 in your case) and then reverse the
array of results.
Comment.find(:all, :order => ''id desc'', :limit =>
20).reverse
or something similar.
There may be a better way though.
chers,
vanne
On Dec 31, 3:55 pm, Fish Man
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi, quick question may be simple to answer,
> how can I use the find method to get the last 20 entries in my mysql
> table:
> Sports.find(:(last 20 entries please), :conditions none)
>
> cheers.fishman()
> --
> Posted viahttp://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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---