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

Don't lose source location of the pagination method

This commit is contained in:
Andrey Koleshko 2016-10-03 11:39:15 +03:00 committed by Akira Matsuda
parent abbf93d557
commit 2e5dedd533

View file

@ -9,7 +9,7 @@ module Kaminari
# Fetch the values at the specified page number # Fetch the values at the specified page number
# Model.page(5) # Model.page(5)
eval <<-RUBY eval <<-RUBY, nil, __FILE__, __LINE__ + 1
def self.#{Kaminari.config.page_method_name}(num = nil) def self.#{Kaminari.config.page_method_name}(num = nil)
limit(default_per_page).offset(default_per_page * ((num = num.to_i - 1) < 0 ? 0 : num)).extending do limit(default_per_page).offset(default_per_page * ((num = num.to_i - 1) < 0 ? 0 : num)).extending do
include Kaminari::ActiveRecordRelationMethods include Kaminari::ActiveRecordRelationMethods