mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use #between
, rather than #in
for passing Ranges to Arel
Passing ranges to `#in` has been deprecated in Arel.
This commit is contained in:
parent
7cf4d5465d
commit
b6a0255519
3 changed files with 3 additions and 2 deletions
1
Gemfile
1
Gemfile
|
@ -14,6 +14,7 @@ gem 'rack-cache', '~> 1.2'
|
|||
gem 'jquery-rails', '~> 4.0.0.beta2'
|
||||
gem 'coffee-rails', '~> 4.1.0'
|
||||
gem 'turbolinks'
|
||||
gem 'arel', github: 'rails/arel', branch: 'master'
|
||||
|
||||
# require: false so bcrypt is loaded only when has_secure_password is used.
|
||||
# This is to avoid ActiveModel (and by extension the entire framework)
|
||||
|
|
|
@ -109,7 +109,7 @@ module ActiveRecord
|
|||
# FIXME: I think we need to deprecate this behavior
|
||||
register_handler(Class, ->(attribute, value) { attribute.eq(value.name) })
|
||||
register_handler(Base, ->(attribute, value) { attribute.eq(value.id) })
|
||||
register_handler(Range, ->(attribute, value) { attribute.in(value) })
|
||||
register_handler(Range, ->(attribute, value) { attribute.between(value) })
|
||||
register_handler(Relation, RelationHandler.new)
|
||||
register_handler(Array, ArrayHandler.new)
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ module ActiveRecord
|
|||
values_predicate = values_predicate.or(attribute.eq(nil))
|
||||
end
|
||||
|
||||
array_predicates = ranges.map { |range| attribute.in(range) }
|
||||
array_predicates = ranges.map { |range| attribute.between(range) }
|
||||
array_predicates.unshift(values_predicate)
|
||||
array_predicates.inject { |composite, predicate| composite.or(predicate) }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue