lib/kaminari/models/configuration_methods.rb in kaminari-0.13.0 vs lib/kaminari/models/configuration_methods.rb in kaminari-0.14.0
- old
+ new
@@ -11,10 +11,24 @@
end
# This model's default +per_page+ value
# returns +default_per_page+ value unless explicitly overridden via <tt>paginates_per</tt>
def default_per_page
- @_default_per_page || Kaminari.config.default_per_page
+ @_default_per_page ||= Kaminari.config.default_per_page
+ end
+
+ # Overrides the max +per_page+ value per model
+ # class Article < ActiveRecord::Base
+ # max_paginates_per 100
+ # end
+ def max_paginates_per(val)
+ @_max_per_page = val
+ end
+
+ # This model's max +per_page+ value
+ # returns +max_per_page+ value unless explicitly overridden via <tt>max_paginates_per</tt>
+ def max_per_page
+ @_max_per_page ||= Kaminari.config.max_per_page
end
end
end
end