Named Scopes and Will_paginate


#1

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


#2

Just use Image.named_scope.paginate instead of Image.paginate.
Presumably
the :order will be in the named scope.

Colin

2009/5/25 Hunt J. removed_email_address@domain.invalid