1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

We do not at all need the accessors

This commit is contained in:
Akira Matsuda 2016-10-11 22:38:16 +09:00
parent 7d49a6cf3c
commit f2a76b8199

View file

@ -7,20 +7,21 @@ module Kaminari
# end
include ActiveSupport::Configurable
config_accessor(:default_per_page, instance_accessor: false) { 25 }
config_accessor(:max_per_page, instance_accessor: false)
config_accessor(:window, instance_accessor: false) { 4 }
config_accessor(:outer_window, instance_accessor: false) { 0 }
config_accessor(:left, instance_accessor: false) { 0 }
config_accessor(:right, instance_accessor: false) { 0 }
config_accessor(:page_method_name, instance_accessor: false) { :page }
config_accessor(:param_name, instance_accessor: false) { :page }
config_accessor(:max_pages, instance_accessor: false)
config_accessor(:params_on_first_page, instance_accessor: false) { false }
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
config.undef_method :param_name
def config.param_name
self[:param_name].respond_to?(:call) ? self[:param_name].call : self[:param_name]
# 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