will_paginate with named_scopes

Posted by Lowgain on Stack Overflow See other posts from Stack Overflow or by Lowgain
Published on 2010-05-07T22:45:29Z Indexed on 2010/05/07 22:48 UTC
Read the original article Hit count: 415

I'm using will_paginate for pagination, which has been working well so far, except for this one thing.

If I try to paginate a scope, for instance

class User < ActiveRecord::Base

    named_scope :scope, lambda { etc }

end

User.scope.paginate({:page => params[:page], :per_page => 10})

That will tell me paginate is an undefined method. I'd rather not have to use a second solution for only this scope, is there something I can do here?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about will-paginate