How to paginate sunspot in this manner?

陌路散爱 提交于 2019-12-04 17:39:58

The first thing that comes to my mind is to query over the Price model:

prices = Price.joins(:product).where(:product_id => [1,2,3]).paginate(:page => params[:page])

And to make things easier for your views: prices.map! { |p| p.product }

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!