Persisting values from relationships at creation time
Hi there!
I'm working on a demo that allows
Given a product with the following attributes
and orders defined with
what is the best way to preserve the
My first try adds a purchase action to the
but this causes me to lose the builtin "not found" error response if the
I also considered an
I'm working on a demo that allows
products to be purchased by users. Since prices might change over time, I'd like to put the price of the product at the time of purchase into the order resource record.Given a product with the following attributes
and orders defined with
what is the best way to preserve the
price value from the product?My first try adds a purchase action to the
Order resource:but this causes me to lose the builtin "not found" error response if the
product_id is invalid.I also considered an
after_action, but it didn't feel right to force change an attribute: