sf8193
How to get proper routes using mix phx.gen.html when you have nested resources in router.ex?
Hi all, to keep it short, I have nested resources inside of the router page like so
resources "/groups", GroupController
resources "/addresses", AddressController
When I run mix phx.gen.html I want to create a resource “shipping” that’s also nested. Unfortunately this complicates the _path function that’s used in many places.
I tried running
mix phx.gen.html Shipments Shipment shipments
but this creates a simple shipment_path in all of the files that then breaks the code and doesn’t allow me to run mix phx.routes, for example, making it hard to even see what the route would be. Is there a standard way to run the mix phx.gen.html command with nested resources?
First Post!
sreyansjain
I don’t think such functionality exists in the generators.
Also when you run the generators you are advised to create the routes in the router yourself by adding code like below yourself.
resources "/groups", GroupController
Generators are there to help, but i think nested resources need to be taken care of manually.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









