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:
parent
98018da222
commit
8438b375de
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue