Yes this should work... maybe the other have an idea.
I have a tip though (it doesn't answer your question):
separate that into two named scopes: recent and by_id so that you can
do Model.recent(id).by_id
More flexible.
Ramon Tayag
On Thu, Oct 2, 2008 at 2:34 AM, rails_in_dc <[EMAIL PROTECTED]> wrote:
>
> I have this simple named_scope that returns all Events after a given
> id:
>
> named_scope :recent_by_id, lambda {|id| {
> :conditions => ['id > ?', id], :order => 'id ASC'
> }}
>
> The problem is that named_scope returns a query with an order by
> clause containing created_at first:
> ORDER BY created_at DESC, id ASC
>
> How do I get named_scope to ignore the created_at and simply give me a
> query sorted by id?
>
> best,
>
> - Matt
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---