aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-04-27 10:08:59 -0700
committerGitHub <noreply@github.com>2017-04-27 10:08:59 -0700
commit2064c61f4b1f52dfe20bbe544db34c9fff1930b3 (patch)
tree60f562ed30068f0ff2dd6dedd9b9bb2df8e8b287 /activerecord/lib/active_record
parent5974334aeb23c21100af5bf877b385dbbe762bc6 (diff)
parent4f8f5f59fc37a6adb71979eec66488f4ad08bffa (diff)
downloadrails-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.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