diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-07-17 10:17:31 -0700 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-07-17 10:17:31 -0700 |
commit | d0ba994f54a4fcf72362535ec0692d4d228d8421 (patch) | |
tree | fc443a8c8c616869eab1056f1723a0c5ad9ffb25 /activerecord/lib | |
parent | 15bfaa3d13f84c689f9182c0be658ddde019e572 (diff) | |
parent | 0c3c2279e7f9b92f606356debc2efe0a93752a69 (diff) | |
download | rails-d0ba994f54a4fcf72362535ec0692d4d228d8421.tar.gz rails-d0ba994f54a4fcf72362535ec0692d4d228d8421.tar.bz2 rails-d0ba994f54a4fcf72362535ec0692d4d228d8421.zip |
Merge pull request #7072 from beerlington/fix_validations_with_scope
Use database value for uniqueness validation scope
Diffstat (limited to 'activerecord/lib')
-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 9e4b588ac2..5a24135f8e 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(options[:scope]).each do |scope_item| - scope_value = record.send(scope_item) + scope_value = record.read_attribute(scope_item) reflection = record.class.reflect_on_association(scope_item) if reflection scope_value = record.send(reflection.foreign_key) |