diff options
author | Narihiro Nakamura <authornari@gmail.com> | 2013-02-26 14:39:26 +0900 |
---|---|---|
committer | Narihiro Nakamura <authornari@gmail.com> | 2013-02-26 14:39:26 +0900 |
commit | 905b7df1fac8332547b9eb7fc4d5b083c6fc1031 (patch) | |
tree | a6b8de1e96448eb6959b166090e6647b12b448a1 /activerecord/lib/active_record | |
parent | 0761bb029886bb6920a404ecf409013f83a44f58 (diff) | |
download | rails-905b7df1fac8332547b9eb7fc4d5b083c6fc1031.tar.gz rails-905b7df1fac8332547b9eb7fc4d5b083c6fc1031.tar.bz2 rails-905b7df1fac8332547b9eb7fc4d5b083c6fc1031.zip |
Backported #7072 to 3-2-stable. Use database value for uniqueness validation scope.
Diffstat (limited to 'activerecord/lib/active_record')
-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 154aacef9f..795088530e 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -26,7 +26,7 @@ module ActiveRecord relation = relation.and(table[finder_class.primary_key.to_sym].not_eq(record.send(:id))) if record.persisted? Array.wrap(options[:scope]).each do |scope_item| - scope_value = record.send(scope_item) + scope_value = record.read_attribute(scope_item) relation = relation.and(table[scope_item].eq(scope_value)) end |