1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00
kaminari--kaminari/kaminari-core/lib/kaminari/config.rb
Akira Matsuda 106cf8071c ❄️
2016-10-12 05:45:39 +09:00

28 lines
746 B
Ruby

# frozen_string_literal: true
require 'active_support/configurable'
module Kaminari
# Configures global settings for Kaminari
# Kaminari.configure do |config|
# config.default_per_page = 10
# end
include ActiveSupport::Configurable
config.instance_eval do
self.default_per_page = 25
self.max_per_page = nil
self.window = 4
self.outer_window = 0
self.left = 0
self.right = 0
self.page_method_name = :page
self.param_name = :page
self.max_pages = nil
self.params_on_first_page = false
# If param_name was given as a callable object, call it when returning
def param_name
self[:param_name].respond_to?(:call) ? self[:param_name].call : self[:param_name]
end
end
end