mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Use Proc.new instead of lambda for scope_options.
lambda is strict about block parameters in 1.9.2, so we might as well just use Proc.new.
This commit is contained in:
parent
ffb04c7da6
commit
6e614149d1
2 changed files with 2 additions and 4 deletions
|
@ -17,9 +17,7 @@ module Kaminari
|
|||
kls.class_eval do
|
||||
# Fetch the values at the specified page number
|
||||
# Model.page(5)
|
||||
scope :page, lambda {|*num|
|
||||
raise ArgumentError if num.size > 1
|
||||
num = num.first || 1
|
||||
scope :page, Proc.new {|num|
|
||||
limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))
|
||||
} do
|
||||
# Specify the <tt>per_page</tt> value for the preceding <tt>page</tt> scope
|
||||
|
|
|
@ -16,7 +16,7 @@ module Kaminari
|
|||
included do
|
||||
# Fetch the values at the specified page number
|
||||
# Model.page(5)
|
||||
scope :page, lambda {|num|
|
||||
scope :page, Proc.new {|num|
|
||||
limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))
|
||||
} do
|
||||
# Specify the <tt>per_page</tt> value for the preceding <tt>page</tt> scope
|
||||
|
|
Loading…
Add table
Reference in a new issue