• S
    Ensure that inverse associations are set before running callbacks · caa178c1
    Sean Griffin 提交于
    If a parent association was accessed in an `after_find` or
    `after_initialize` callback, it would always end up loading the
    association, and then immediately overwriting the association we just
    loaded. If this occurred in a way that the parent's `current_scope` was
    set to eager load the child, this would result in an infinite loop and
    eventually overflow the stack.
    
    For records that are created with `.new`, we have a mechanism to
    perform an action before the callbacks are run. I've introduced the same
    code path for records created with `instantiate`, and updated all code
    which sets inverse instances on newly loaded associations to use this
    block instead.
    
    Fixes #26320.
    caa178c1
core.rb 19.3 KB