i want a pagination in my page, im using ruby and kaminari to this.
class ServicesController < ApplicationController
def index
/@services = Service.order(name: :asc)/
@organs = Admin::Organ.all
@services = @services.order(created_at: :desc).paginate(page:params[:page], per_page: 3 )
end
this code, my control try paginate pages 3 to 3. In views:
<%= paginate @organ.services %>
As i want call the services with relationship to each organ i insert que last code im my view.
The result are:
undefined method `total_pages' for #<Mongoid::Criteria:0x007f18a8b1f338>
if you can help, grateful for the attention!
Try changing your controller code like the following:
try this
Old code
New code