Forum: Ruby on Rails Named Scopes and Will_paginate

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Hunt J. (Guest)
on 2009-05-25 15:31
(Received via mailing list)
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

Can anybody help me on this?

Colin L. (Guest)
on 2009-05-25 17:07
(Received via mailing list)
Just use Image.named_scope.paginate instead of Image.paginate.
the :order will be in the named scope.


2009/5/25 Hunt J. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.