diff options
author | beerlington <pete@lette.us> | 2012-07-17 07:27:54 -0400 |
---|---|---|
committer | beerlington <pete@lette.us> | 2012-07-17 07:27:54 -0400 |
commit | 0c3c2279e7f9b92f606356debc2efe0a93752a69 (patch) | |
tree | fc443a8c8c616869eab1056f1723a0c5ad9ffb25 /activerecord/lib/active_record | |
parent | 15bfaa3d13f84c689f9182c0be658ddde019e572 (diff) | |
download | rails-0c3c2279e7f9b92f606356debc2efe0a93752a69.tar.gz rails-0c3c2279e7f9b92f606356debc2efe0a93752a69.tar.bz2 rails-0c3c2279e7f9b92f606356debc2efe0a93752a69.zip |
Fixes "Cannot visit ..." with validates_uniqueness_of
Fixes issue with overrding ActiveRecord reader methods with a
composed object and using that attribute as the scope of a
validates_uniqueness_of validation.
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 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) |