I'm writing a timeline, that stores events in a table when there are changes to objects, such as "products".
I've written an observer for Product that composes a sensible log message and associated data using "after_create" and "before_update" and so on. This works perfectly.
Now, each Product has many Variants, and also, each Variant has many Prices. However they are typically edited in the same form. But only changes to the Product-class cause the observer to trigger "before_update".
I would like changes to Variants to trigger the Product-observer for the associated product, and in the same way cause changes to Prices trigger the product associated with the Variant associated with the Price.
This is not unlike the :touch functionality in Rails 2.3.3+. I've also tried to depend on that function, but the touching does not seem to trigger the before_update observer method.
How would you do this?
Based on my current experience touch should trigger regular callbacks but not observer callbacks. As these are slightly different.