diff options
author | Arthur Neves <arthurnn@gmail.com> | 2014-05-24 14:03:30 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2014-05-24 14:55:20 -0400 |
commit | 09ac448a8eff73ffb7a3f683207802e8cb1f6d0b (patch) | |
tree | 668528eedc99f79d91431c7b7dd6acccd42d5221 /activerecord/lib/active_record/validations | |
parent | e2bd0eb758100a5d6f55201318809a7ed7b37040 (diff) | |
download | rails-09ac448a8eff73ffb7a3f683207802e8cb1f6d0b.tar.gz rails-09ac448a8eff73ffb7a3f683207802e8cb1f6d0b.tar.bz2 rails-09ac448a8eff73ffb7a3f683207802e8cb1f6d0b.zip |
Merge pull request #15210 from arthurnn/fix_hbtm_reflection
Fix habtm reflection
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/counter_cache.rb
activerecord/lib/active_record/reflection.rb
activerecord/test/cases/reflection_test.rb
Diffstat (limited to 'activerecord/lib/active_record/validations')
-rw-r--r-- | activerecord/lib/active_record/validations/presence.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/validations/presence.rb b/activerecord/lib/active_record/validations/presence.rb index 9a19483da3..e586744818 100644 --- a/activerecord/lib/active_record/validations/presence.rb +++ b/activerecord/lib/active_record/validations/presence.rb @@ -4,7 +4,7 @@ module ActiveRecord def validate(record) super attributes.each do |attribute| - next unless record.class.reflect_on_association(attribute) + next unless record.class._reflect_on_association(attribute) associated_records = Array.wrap(record.send(attribute)) # Superclass validates presence. Ensure present records aren't about to be destroyed. diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index ee080451a9..b6fccc9b94 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -47,7 +47,7 @@ module ActiveRecord end def build_relation(klass, table, attribute, value) #:nodoc: - if reflection = klass.reflect_on_association(attribute) + if reflection = klass._reflect_on_association(attribute) attribute = reflection.foreign_key value = value.attributes[reflection.primary_key_column.name] unless value.nil? end @@ -74,7 +74,7 @@ module ActiveRecord def scope_relation(record, table, relation) Array(options[:scope]).each do |scope_item| - if reflection = record.class.reflect_on_association(scope_item) + if reflection = record.class._reflect_on_association(scope_item) scope_value = record.send(reflection.foreign_key) scope_item = reflection.foreign_key else |