Resting Pug logo Resting Pug

Description

Selects certain page from all subjects using pagination params

Tip

Override this method to change pagination of subjects

Used in

Use

Example

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a paginate_subjects method to use kaminari instead of will_paginate
  def paginate_subjects
    @subjects = @subjects.page(pagination_params[:page]).per(pagination_params[:per_page])
  end
end

Source code

# lib/resting_pug/modificators.rb

def paginate_subjects
  @subjects = @subjects.paginate(page: pagination_params[:page], per_page: pagination_params[:per_page])
end
Find me on GitHub