Improve update function
Opened this issue · 0 comments
Danwhy commented
Currently we've had to override the update function for a few of our modules in CS, because we need to add in the many_to_many
or one_to_many
associations.
It should be possible to abstract this out into this module, by using
__MODULE__.__schema__(:associations)
to get all of the associations, then map through that with __MODULE__.__schema__(:association, assoc)
to get detailed information on each association, including whether it's a many_to_many
, one_to_many
etc, then comparing it with the updated attributes and dealing with any updated associations in the appropriate way.