Module: Kaminari::ConfigurationMethods::ClassMethods
- Included in:
- PaginatableArray
- Defined in:
- lib/kaminari/models/configuration_methods.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#default_per_page ⇒ Object
This model’s default
per_page
value returnsdefault_per_page
value unless explicitly overridden viapaginates_per
. -
#max_pages(val = :none) ⇒ Object
Overrides the max_pages value per model when a value is given class Article < ActiveRecord::Base max_pages 100 end.
- #max_pages_per(val) ⇒ Object
-
#max_paginates_per(val) ⇒ Object
Overrides the max
per_page
value per model class Article < ActiveRecord::Base max_paginates_per 100 end. -
#max_per_page ⇒ Object
This model’s max
per_page
value returnsmax_per_page
value unless explicitly overridden viamax_paginates_per
. -
#paginates_per(val) ⇒ Object
Overrides the default
per_page
value per model class Article < ActiveRecord::Base paginates_per 10 end.
Instance Method Details
#default_per_page ⇒ Object
This model’s default per_page
value returns default_per_page
value unless explicitly overridden via paginates_per
19 20 21 |
# File 'lib/kaminari/models/configuration_methods.rb', line 19 def default_per_page (defined?(@_default_per_page) && @_default_per_page) || Kaminari.config.default_per_page end |
#max_pages(val = :none) ⇒ Object
Overrides the max_pages value per model when a value is given
class Article < ActiveRecord::Base
max_pages 100
end
Also returns this model’s max_pages value (globally configured max_pages
value unless explicitly overridden) when no value is given
44 45 46 47 48 49 50 51 52 |
# File 'lib/kaminari/models/configuration_methods.rb', line 44 def max_pages(val = :none) if val == :none # getter (defined?(@_max_pages) && @_max_pages) || Kaminari.config.max_pages else # setter @_max_pages = val end end |
#max_pages_per(val) ⇒ Object
54 55 56 57 |
# File 'lib/kaminari/models/configuration_methods.rb', line 54 def max_pages_per(val) ActiveSupport::Deprecation.warn 'max_pages_per is deprecated. Use max_pages instead.' max_pages val end |
#max_paginates_per(val) ⇒ Object
Overrides the max per_page
value per model
class Article < ActiveRecord::Base
max_paginates_per 100
end
27 28 29 |
# File 'lib/kaminari/models/configuration_methods.rb', line 27 def max_paginates_per(val) @_max_per_page = val end |
#max_per_page ⇒ Object
This model’s max per_page
value returns max_per_page
value unless explicitly overridden via max_paginates_per
33 34 35 |
# File 'lib/kaminari/models/configuration_methods.rb', line 33 def max_per_page (defined?(@_max_per_page) && @_max_per_page) || Kaminari.config.max_per_page end |
#paginates_per(val) ⇒ Object
Overrides the default per_page
value per model
class Article < ActiveRecord::Base
paginates_per 10
end
13 14 15 |
# File 'lib/kaminari/models/configuration_methods.rb', line 13 def paginates_per(val) @_default_per_page = val end |