diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-04-27 10:08:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-27 10:08:59 -0700 |
commit | 2064c61f4b1f52dfe20bbe544db34c9fff1930b3 (patch) | |
tree | 60f562ed30068f0ff2dd6dedd9b9bb2df8e8b287 /activerecord/lib/active_record | |
parent | 5974334aeb23c21100af5bf877b385dbbe762bc6 (diff) | |
parent | 4f8f5f59fc37a6adb71979eec66488f4ad08bffa (diff) | |
download | rails-2064c61f4b1f52dfe20bbe544db34c9fff1930b3.tar.gz rails-2064c61f4b1f52dfe20bbe544db34c9fff1930b3.tar.bz2 rails-2064c61f4b1f52dfe20bbe544db34c9fff1930b3.zip |
Merge pull request #28906 from georgeclaghorn/fix-belongs-to-default-with-lambda
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 |