ruby on rails - Filtered Pagination with Kaminari -
i set website uses ajax-pagination powered kaminari. have set simple filtering , searching, can browse list on http://example.com/products/filter?query=blah.
i'm using kaminari's built-in link_to_next_page
helper generate next-page link. problem comes because generated link ignores queries/filters, sending on http://example.com/products/filter?query=blah http://example.com/products?page=2
one solution i've toyed rewrite link_to_next_page helper include filters , search-terms, (as things) more work expected. there better way?
according link_to_next_page document, should query_string env, keep query parameter
def link_to_next_page(scope, name, options = {}) params = options.delete(:params) ||(rack::utils.parse_query(env['query_string']).symbolize_keys rescue {})
if not work expect, can pass params yourself
<%= link_to_next_page @items, 'next page', :params => params %>
Comments
Post a Comment