I’m struggling with my first phoenix project on managing dependent entities on different views.
I would like to create entities that depend on each other.
The example is as follows:
Site >has_many> Intervention >has_many> Task
I created each using phx.gen.html. I also included a field to select the dependence when using the :new page of each resource by loading the list of existing sites in intervention new for example.
I would like to also provide the possibility to create a new intervention from the show page of a site. Then create a new task from the show page of the intervention. I would like it to automatically set the id of the parent resources in the form.
How can I use the existing controller to do that (pass the id of site using the create controller of intervention)?
Side question: is this a case for using nested resources? If yes how deep is it reasonable to go in nesting?