Your current solution seems "dangerous" if the update throws an exception, then the callbacks do not return to their place, which can seriously violate any request after it. Self-modifying code is a really bad idea, if it can have constant side effects for other threads, it is a bit like using global variables.
But I have a problem, and all the time I was looking for a solution, and yours was the best that I could find so far. I think Rails might need to add a more elegant way to do this for the callback module.
Jan m source share