diff options
author | George Claghorn <george@basecamp.com> | 2017-04-27 12:35:48 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2017-04-27 12:36:50 -0400 |
commit | 4f8f5f59fc37a6adb71979eec66488f4ad08bffa (patch) | |
tree | 60f562ed30068f0ff2dd6dedd9b9bb2df8e8b287 /activerecord/lib/active_record | |
parent | 5974334aeb23c21100af5bf877b385dbbe762bc6 (diff) | |
download | rails-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/active_record')
-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 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 |