Using mix phoenix.gen.html
, I created a new Ecto model and associated routes, and added the resources "/users", UserController
to my router.ex. As expected, this autogenerated urls like /users/:id
, /users/:id/edit
, etc.
I'd like to change the URL structure to something like /users/:slug/:id/
, where slug is a field on the User model. Is there a way to specify this new URL structure while still using the Phoenix resource routes?
If it makes things easier: I don't particularly care about validating :slug
, or ensuring it's correct if the client makes a typo. I just want Phoenix to accept/generate URLs with that structure.