Yogh Yogh - 2 months ago 13x
Ruby Question

Temporarily disable Kaminari pagination in Spree

I'm making a Spree site that has links for changing the number of products per page including a link for All. The links for a number are easy because I can just pass a

param via the query string and helper methods. However, I can't figure out what I need to pass to either tell Kaminari to not paginate or to temporarily disable Kaminari.

I'm happy for a solution either in Spree or in Kaminari. I would prefer a method other than
:per_page = 1000
or some similarly large number.

  • Spree 0.70.3

  • Kaminari 0.13.0


Could you pass a querystring parameter and then filter it inside your controller action? For example:

def show
  @products = unless params[:show_all]

I know this doesn't give you a solution in either Spree or Kaminari but it might help to work around the issue. I'd love to know if there was another way built in to the library though.