diff options
author | Diego Carrion <dc.rec1@gmail.com> | 2015-06-16 13:15:58 -0300 |
---|---|---|
committer | Diego Carrion <dc.rec1@gmail.com> | 2015-06-16 16:12:52 -0300 |
commit | ba7377e8176315e7ac6ba1c24b2479925dc37cde (patch) | |
tree | 3e6c4e892f9c406fb7fa8763ef389f4708b15643 /activerecord/lib/active_record/associations | |
parent | e60c18931c81a88f4eb89059e955d6ff07c5e26c (diff) | |
download | rails-ba7377e8176315e7ac6ba1c24b2479925dc37cde.tar.gz rails-ba7377e8176315e7ac6ba1c24b2479925dc37cde.tar.bz2 rails-ba7377e8176315e7ac6ba1c24b2479925dc37cde.zip |
raise ActiveModel::MissingAttributeError when trying to access a relationship without the foreign key attribute
fixes regression reported on #20253
ActiveRecord::Base#[] was not used cause of 8b95420
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/belongs_to_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 265a65c4c1..260a0c6a2d 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -107,7 +107,7 @@ module ActiveRecord end def stale_state - result = owner._read_attribute(reflection.foreign_key) + result = owner._read_attribute(reflection.foreign_key) { |n| owner.send(:missing_attribute, n, caller) } result && result.to_s end end |