hey all, if I have a parent object, and before saving that parent object I create and save an association, is that expected to trigger an `after_create` callback on the parent model? I’m experiencing that right now and trying to determine if there’s a side effect elsewhere in the code or not
so so appreciated ha, i was stepping through pry and saw the callback on the parent object being executed well before parent_obj.save and i was like wtf there’s gonna be some single line somewhere in this huge codebase that’s breaking expectations, so thank you!
Linell: know of any way to isolate that behavior? i.e. only want a given callback to execute upon object creation, but unaffected by any other model object transactions
only thing off the top of my head is to make it an `after_save` callback and add a `persisted?` check
Linell: yea been playing around w some integration tests, looks like `persisted?` will always return true when executed in the context of an `after_save` callback
thought maybe it would return false if it’s before final transaction completes, like `after_commit`…oh well
agreed, my fix is a one liner but it’d be nice to avoid any exception logic by decoupling the parent object’s creation from the association object’s, but i also get why that’s the case