Attributes on `many_to_many` join/through resources.
Considering the following resources.
The following create attempt fails.
This is because attributes
:quantity
and :unit
are not being set on FormulaReactant
. How would a create action on Formula
be setup to set both attributes?3 Replies
I don't think that there is anything out of the box that helps with this case, but the many_to_many also adds another relationship to your resource for the through resource
https://ash-hq.org/docs/dsl/ash-resource#relationships-many_to_many-join_relationship
So I think what you could do is something like this.
In a way passing the data through the related resources yourselfYeah, this is exactly what I was hoping for. Cheers!
Btw, you don't need to make the actions the primary actions, you can also specify a specific action per operation e.g
on_no_match: {:create, :create_action_name}