class V1::LicensesController < ApplicationController PER_PAGE = 10 DEFAULT_PAGE = 1 before_filter :prepare_pagination def index @licenses = License.most_recent(page: @page, per_page: @per_page) end def show @license = License.find(params[:id]) end private def prepare_pagination @page = params[:page].present? ? params[:page].to_i : DEFAULT_PAGE @per_page = params[:per_page].present? ? params[:per_page].to_i : PER_PAGE end end