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

Fix for Model.all.page in DataMapper

This commit is contained in:
Whitney Young 2013-10-25 13:46:36 -03:00
parent 98018da222
commit 8438b375de

View file

@ -5,8 +5,10 @@ module Kaminari
module Paginatable
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{Kaminari.config.page_method_name}(num = 1)
model = self
model = self.model if self.is_a? DataMapper::Collection
num = [num.to_i, 1].max - 1
all(:limit => default_per_page, :offset => default_per_page * num).extend Paginating
all(:limit => model.default_per_page, :offset => model.default_per_page * num).extend Paginating
end
RUBY
end