diff options
author | kennyj <kennyj@gmail.com> | 2012-03-30 03:51:08 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-04-13 02:25:19 +0900 |
commit | 365b8b6db750151b786b0a7ef9e65a6824576f1b (patch) | |
tree | e19ddad03c4792318b4f66f9c07d6ffe3e080c44 /activerecord/lib | |
parent | 0f3901e9101837eaab2daba5b01f67ed7e2c75d5 (diff) | |
download | rails-365b8b6db750151b786b0a7ef9e65a6824576f1b.tar.gz rails-365b8b6db750151b786b0a7ef9e65a6824576f1b.tar.bz2 rails-365b8b6db750151b786b0a7ef9e65a6824576f1b.zip |
Fix #5563. Should reflect the most recent change to either of association / id.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/association.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 4e09a43f8e..e75003f261 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -132,7 +132,8 @@ module ActiveRecord # ActiveRecord::RecordNotFound is rescued within the method, and it is # not reraised. The proxy is \reset and +nil+ is the return value. def load_target - @target ||= find_target if find_target? + @target = find_target if (@stale_state && stale_target?) || find_target? + loaded! unless loaded? target rescue ActiveRecord::RecordNotFound |