Pagination 带轨道条件的Kaminari分页

Pagination 带轨道条件的Kaminari分页,pagination,ruby-on-rails-3.2,kaminari,Pagination,Ruby On Rails 3.2,Kaminari,我正在尝试为我的rails项目的Kaminari分页添加条件,我发现这几乎是不可能的。这是我的密码 UserController #feed=Feed.order('created_at desc').page(params[:page], :conditions=>["source=? or source=?","beep","sub_beep"]) 上述方法不起作用,所以我尝试了以下方法 @feed1 = Feed.find(:all,:conditions=&

我正在尝试为我的rails项目的Kaminari分页添加条件,我发现这几乎是不可能的。这是我的密码

  UserController
#feed=Feed.order('created_at desc').page(params[:page], :conditions=>["source=? or        source=?","beep","sub_beep"])
上述方法不起作用,所以我尝试了以下方法

  @feed1 = Feed.find(:all,:conditions=>["source=? or source=?","beep","sub_beep"])
  @feed= Kaminari.paginate_array(@feed1).page(params[:page]).per(2)
上面显示内容,但每页不显示2个内容,并且显示的元素没有顺序

我需要一种向kaminari分页添加条件并对结果排序的方法


求求你,我需要帮助!!!:(

Kaminari仅设计用于使用ActiveRecord 3+样式的查询接口

请避免使用
:conditions
“Hasheritis”语法,该语法迟早会被弃用,但会使用
where
方法链接

where
方法的使用在Rails指南中有详细说明:

控制器代码应如下所示:

feeds = Feed.where(:source => ['beep', 'sub_beep']).order('created_at desc').page(params[:page])