Skip to content
Browse files

Fix #5563. Should reflect the most recent change to either of associa…

…tion / id.
  • Loading branch information...
1 parent 1fcd7c9 commit 0929650af74ef4117be9414ea42f076cfcb1fa27 @kennyj committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/associations/singular_association.rb
View
2 activerecord/lib/active_record/associations/singular_association.rb
@@ -43,7 +43,7 @@ def build(attributes = {}, options = {})
# 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_target? && @stale_state.present?) || find_target?
loaded! unless loaded?
target
rescue ActiveRecord::RecordNotFound

0 comments on commit 0929650

Please sign in to comment.
Something went wrong with that request. Please try again.