diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-01-14 13:22:54 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-01-18 14:56:43 +0900 |
commit | 5b6daff5b6d5439e07c058718069f54b34970f93 (patch) | |
tree | 2056e890057bb59eeef8356eb41741037aadcfaa /activerecord/lib/active_record/validations | |
parent | eb63faaa1af7ef28ae1a716d068acc447e28c174 (diff) | |
download | rails-5b6daff5b6d5439e07c058718069f54b34970f93.tar.gz rails-5b6daff5b6d5439e07c058718069f54b34970f93.tar.bz2 rails-5b6daff5b6d5439e07c058718069f54b34970f93.zip |
Use `unboundable?` rather than `boundable?`
The `unboundable?` behaves like the `infinite?`.
```ruby
inf = Topic.predicate_builder.build_bind_attribute(:id, Float::INFINITY)
inf.infinite? # => 1
oob = Topic.predicate_builder.build_bind_attribute(:id, 9999999999999999999999999999999)
oob.unboundable? # => 1
inf = Topic.predicate_builder.build_bind_attribute(:id, -Float::INFINITY)
inf.infinite? # => -1
oob = Topic.predicate_builder.build_bind_attribute(:id, -9999999999999999999999999999999)
oob.unboundable? # => -1
```
Diffstat (limited to 'activerecord/lib/active_record/validations')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 111b6c9a64..fb745af125 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -58,7 +58,7 @@ module ActiveRecord def build_relation(klass, attribute, value) relation = klass.unscoped comparison = relation.bind_attribute(attribute, value) do |attr, bind| - return relation.none! unless bind.boundable? + return relation.none! if bind.unboundable? if bind.nil? attr.eq(bind) |