Ruby on Rails Monday, August 29, 2011

On Sun, Aug 28, 2011 at 12:21 PM, Tom Meinlschmidt
<tomas@meinlschmidt.com> wrote:

>> scope :latest, lambda {|number| { :order => :updated_at, :limit => number } }
>
> just a note .. request was for LAST two records… with this order query will return first two records, assume use
>
> :order => 'published_at desc'

D'oh -- good point, thanks for catching that.

And of course my example should have used 'published_at' rather
than 'updated_at'; fingers on autopilot!

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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@googlegroups.com.
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.

No comments:

Post a Comment