aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-02-23 12:24:07 -0700
committerSean Griffin <sean@seantheprogrammer.com>2016-02-23 12:24:07 -0700
commit96c1ada82d90810df92f402da0c063e8bc0d01ed (patch)
tree817df8fe90e462c1e216cf73f5c12f6dcab72eea /activerecord/lib
parent3adc35aefa7e5f58fe0e7d6678daeaa5e47dd7df (diff)
parent55385c8a39117f5c1b78fcb703f9d7ac14d97d12 (diff)
downloadrails-96c1ada82d90810df92f402da0c063e8bc0d01ed.tar.gz
rails-96c1ada82d90810df92f402da0c063e8bc0d01ed.tar.bz2
rails-96c1ada82d90810df92f402da0c063e8bc0d01ed.zip
Merge pull request #23628 from maclover7/fix-23625
Fix issue #23625
Diffstat (limited to 'activerecord/lib')
-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 88c272657f..1eb5005791 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -17,7 +17,7 @@ module ActiveRecord
value = map_enum_attribute(finder_class, attribute, value)
relation = build_relation(finder_class, table, attribute, value)
- if record.persisted? && finder_class.primary_key.to_s != attribute.to_s
+ if record.persisted?
if finder_class.primary_key
relation = relation.where.not(finder_class.primary_key => record.id_was)
else