mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use @limit_value and @offset_value instead of calling arel
This commit is contained in:
parent
8d31c9f3a0
commit
459e9b29d4
2 changed files with 5 additions and 5 deletions
|
@ -80,7 +80,7 @@ module ActiveRecord
|
|||
if block_given?
|
||||
to_a.many? { |*block_args| yield(*block_args) }
|
||||
else
|
||||
arel.send(:taken).present? ? to_a.many? : size > 1
|
||||
@limit_value.present? ? to_a.many? : size > 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -272,15 +272,15 @@ module ActiveRecord
|
|||
result = where(primary_key.in(ids)).all
|
||||
|
||||
expected_size =
|
||||
if arel.taken && ids.size > arel.taken
|
||||
arel.taken
|
||||
if @limit_value && ids.size > @limit_value
|
||||
@limit_value
|
||||
else
|
||||
ids.size
|
||||
end
|
||||
|
||||
# 11 ids with limit 3, offset 9 should give 2 results.
|
||||
if arel.skipped && (ids.size - arel.skipped < expected_size)
|
||||
expected_size = ids.size - arel.skipped
|
||||
if @offset_value && (ids.size - @offset_value < expected_size)
|
||||
expected_size = ids.size - @offset_value
|
||||
end
|
||||
|
||||
if result.size == expected_size
|
||||
|
|
Loading…
Reference in a new issue