I use the kaminari pagination gem. I can restrict the results per page to 6. This is an example of my pagination in my products_controller:
def index
@products = Product.order(:title).page(params[:page]).per(6)
end
But rather than hard coding the "6" in the pagination code, I want the user to be able to change this through the user interface view. I want a drop down menu on the view so that the user can select either "3", "6", or "9". How can I do this? I'm guessing it might involve an instance variable to store the user's selection but I'm not sure, can anyone help? I have this drop down menu in my application.html.erb:
<div id="per-page">
<select>
<option value="3">3</option>
<option value="6">6</option>
<option value="9">9</option>
</select>
</div>