I have seen a couple of questions on this and tried them but it doesn't help. I am using will_paginate 3.0.7 gem. Where exactly am I going wrong?
Here is my code:
Categories_controller.rb:
def show
@category = Category.includes(:products).find(params[:categoryid])
@products = @category.products.paginate(page: params[:page], per_page: 10)
end
_product.html.erb
<%= will_paginate %>
<ul class="categories">
<% @products.each do |product| %>
<li>
<%= link_to product.productname,product %>
</li>
</ul>
Thank you