• R
    Prevent double firing the before save callback of new object when the parent... · c0038f7c
    Ryuta Kamizono 提交于
    Prevent double firing the before save callback of new object when the parent association saved in the callback
    
    Related #18155, #26661, 268a5bb0, #27434, #27442, and #28599.
    
    Originally #18155 was introduced for preventing double insertion caused
    by the after save callback. But it was caused the before save issue
    (#26661). 268a5bb0 fixed #26661, but it was caused the performance
    regression (#27434). #27442 added new record to `target` before calling
    callbacks for fixing #27434. But it was caused double firing before save
    callback (#28599). We cannot add new object to `target` before saving
    the object.
    
    This is improving #18155 to only track callbacks after `save`.
    
    Fixes #28599.
    c0038f7c
has_many_associations_test.rb 81.8 KB