This week I ran into a surprise when coding up an ...
# general
r
This week I ran into a surprise when coding up an integration to Solidus: • initialize an invalid
Spree::Product
(do not provide a name) • create a valid
Spree::Variant
, assign this as master to the product • call
save!
on the variant The variant will be saved with an empty product, instead of both failing validation. Doing the reverse, calling
save!
on the invalid product will fail both, leaving neither persisted to the database. This seems to follow the (implied) guidance for autosaving associations that saving the parent end of the relation will save the children (but apparently not the reverse.) Not sure whether that is worth documenting or adjusting, but thought it was worth sharing here.
k
Hey, thanks for sharing. Which version of Solidus are you using?