diff --git a/lib/kaminari/models/data_mapper_extension.rb b/lib/kaminari/models/data_mapper_extension.rb index 4778da7..396dba8 100644 --- a/lib/kaminari/models/data_mapper_extension.rb +++ b/lib/kaminari/models/data_mapper_extension.rb @@ -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