Trying to use will_paginate gem.
My Gem file has:
gem 'will_paginate', '~> 3.0.0'
My orders_controllers.rb:
def index
@orders = Order.all.paginate(:page => params[:page], :per_page => 20)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
end
On my index.html.erb I've put:
<%= will_paginate @orders %>
Error:
NoMethodError in OrdersController#index
undefined method `paginate' for #<Array:0x007f79a1be62f8>
Rails.root: /home/askar/Dropbox/rails_studio/somics
Application Trace | Framework Trace | Full Trace
app/controllers/orders_controller.rb:5:in `index'
I now there's kaminari gem for pagination, but I want to know about will_paginate.