Find method

Hi, quick question may be simple to answer,
how can I use the find method to get the last 20 entries in my mysql
Sports.find(:(last 20 entries please), :conditions none)


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.


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