开发者

Issue with Kaminari while using meta_search for column ordering

I am using Kaminari for pagination and trying to use meta_search for column ordering. I would like my code to look like this:

@search = Organization.search(params[:search])
@organizations = @search.page(params[:page])

When I write it this way, I am getting the error,

undefi开发者_开发知识库ned method `page' for #<MetaSearch::Builder:0x7fadb8958630>

The solution I have found is this:

@search = Organization.search(params[:search])
@organizations = Kaminari.paginate_array(@search.all).page(params[:page]

It works but feels clunky. All the examples I have found suggest the first example should work out of the box. Is there any way to turn the MetaSearch result into an ActiveRecord compatible object?


Try a newer version of meta_search +1.0 it provides integration with Kaminari.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜