will_paginate with named_scopes

后端 未结 4 1970
野趣味
野趣味 2021-02-02 14:56

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          


        
4条回答
  •  一生所求
    2021-02-02 15:24

    I have a named_scope defined like this:

     named_scope :look_for, lambda { |search| bla;bla;bla }
    

    I call it:

     Person.look_for(params[:search]).paginate :page => params[:page]
    

    And it works. Maybe you need some parameter to your scope?

提交回复
热议问题