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.
精彩评论