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.
9239e324751b8db551789e5e16689438?d=identicon&s=25 Hunt Jon (Guest)
on 2009-05-25 13: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?

5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-05-25 15: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 Jon <>
This topic is locked and can not be replied to.