• A
    Make sure we touch all the parents when touch_later. · e7c48db5
    Arthur Neves 提交于
    The problem was that when saving an object, we would
    call touch_later on the parent which wont be saved immediteally, and
    it wont call any callbacks. That was working one level up because
    we were calling touch, during the touch_later commit phase. However that still
    didnt solve the problem when you have a 3+ levels of parents to be touched,
    as calling touch would affect the parent, but it would be too late to run callbacks
    on its grand-parent.
    
    The solution for this, is instead, call touch_later upwards when the first
    touch_later is called. So we make sure all the timestamps are updated without relying
    on callbacks.
    
    This also removed the hard dependency BelongsTo builder had with the TouchLater module.
    So we can still have the old behaviour if TouchLater module is not included.
    
    [fixes 5f5e6d92]
    [related #19324]
    e7c48db5
belongs_to.rb 4.2 KB