aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2017-04-27 12:35:48 -0400
committerGeorge Claghorn <george@basecamp.com>2017-04-27 12:36:50 -0400
commit4f8f5f59fc37a6adb71979eec66488f4ad08bffa (patch)
tree60f562ed30068f0ff2dd6dedd9b9bb2df8e8b287 /activerecord/lib
parent5974334aeb23c21100af5bf877b385dbbe762bc6 (diff)
downloadrails-4f8f5f59fc37a6adb71979eec66488f4ad08bffa.tar.gz
rails-4f8f5f59fc37a6adb71979eec66488f4ad08bffa.tar.bz2
rails-4f8f5f59fc37a6adb71979eec66488f4ad08bffa.zip
Evaluate belongs_to :default option against the owner, not the association
Diffstat (limited to 'activerecord/lib')
-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 a2432e389a..0e61dbfb00 100644
--- a/activerecord/lib/active_record/associations/belongs_to_association.rb
+++ b/activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -22,7 +22,7 @@ module ActiveRecord
end
def default(&block)
- writer(instance_exec(&block)) if reader.nil?
+ writer(owner.instance_exec(&block)) if reader.nil?
end
def reset