aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/belongs_to_association.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-06-16 13:36:28 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-06-16 13:36:28 -0600
commitaf01f45f068ea382257090ec8a3aa2579e56dbdc (patch)
tree3e6c4e892f9c406fb7fa8763ef389f4708b15643 /activerecord/lib/active_record/associations/belongs_to_association.rb
parente60c18931c81a88f4eb89059e955d6ff07c5e26c (diff)
parentba7377e8176315e7ac6ba1c24b2479925dc37cde (diff)
downloadrails-af01f45f068ea382257090ec8a3aa2579e56dbdc.tar.gz
rails-af01f45f068ea382257090ec8a3aa2579e56dbdc.tar.bz2
rails-af01f45f068ea382257090ec8a3aa2579e56dbdc.zip
Merge pull request #20578 from dcrec1/regression
raise ActiveModel::MissingAttributeError when trying to access a relationship without the foreign key attribute
Diffstat (limited to 'activerecord/lib/active_record/associations/belongs_to_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/belongs_to_association.rb2
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