11175
(-- --)
1
I'm looking to do a Post.find(:all) -- finding all entries but the
newest one created. Maybe something in this format, although I'm not
sure:
Post.find(:all, :order => "created_at DESC", :conditions => "**EXCLUDE
NEWEST ENTRY CREATED**"])
Any idea?
rubynuby
(rubynuby)
2
Bob Sanders wrote:
I'm looking to do a Post.find(:all) -- finding all entries but the
newest one created. Maybe something in this format, although I'm not
sure:
Post.find(:all, :order => "created_at DESC", :conditions => "**EXCLUDE
NEWEST ENTRY CREATED**"])
I don't think you can do with a SQL. Just find all and get rid of it.
Post.find(:all), :order=>'created_at DESC').shift
or
Post.find(:all), :order=>'created_at').pop
You could exclude the highest possible id, with :conditions => " id !=
max(id) "
-john