aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-03-04 03:30:13 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-03-04 03:30:13 +0900
commit6932998fc7aecba6ade04f8d799f07b494dd402c (patch)
treea52a66b8c8e21caf4139e0806b6ee17ff28de31f /activerecord/lib/active_record/validations
parent7d5a7b30cc79d91f3e3fa8ee81a077276947eb72 (diff)
downloadrails-6932998fc7aecba6ade04f8d799f07b494dd402c.tar.gz
rails-6932998fc7aecba6ade04f8d799f07b494dd402c.tar.bz2
rails-6932998fc7aecba6ade04f8d799f07b494dd402c.zip
`id_in_database` do not return nil value for persisted record
This removes `|| id` which were added in #9963 and #23887 since it is no longer necessary.
Diffstat (limited to 'activerecord/lib/active_record/validations')
-rw-r--r--activerecord/lib/active_record/validations/uniqueness.rb2
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 4c2c5dd852..5a1dbc8e53 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -23,7 +23,7 @@ module ActiveRecord
relation = build_relation(finder_class, attribute, value)
if record.persisted?
if finder_class.primary_key
- relation = relation.where.not(finder_class.primary_key => record.id_in_database || record.id)
+ relation = relation.where.not(finder_class.primary_key => record.id_in_database)
else
raise UnknownPrimaryKey.new(finder_class, "Can not validate uniqueness for persisted record without primary key.")
end