Just use Image.named_scope.paginate instead of Image.paginate. Presumably
the :order will be in the named scope.
Colin
2009/5/25 Hunt Jon <jona.hunt777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> I would like to move the following code to a model using named_scopes.
> I cannot find a good example to show me the way name_scopes and
> will_paginate go hand in hand.
>
> @images = Image.paginate :page => params[:page],
> :per_page => 10, :order =>
''created_at DESC''
>
> Can anybody help me on this?
>
> John
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---