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 <[email protected]>

>
> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to