You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/concerns/admins/paginate_helper.rb

15 lines
324 B

module Admins::PaginateHelper
extend ActiveSupport::Concern
def page
params[:page].to_i <= 0 ? 1 : params[:page].to_i
end
def per_page
params[:per_page].to_i <= 0 || params[:per_page].to_i > 100 ? 20 : params[:per_page].to_i
end
def paginate(relations)
relations.page(page).per(per_page)
end
end