Hi,
a follow up after reading this other topic How to shorten a too long phoenix router path helper name?
Enclosing the injected routes in a “dummy” scope as: false, alias: false do
… end
block seems to do the trick since as: false
resets route’s prefix name.
From my initial example:
scope "/foo", as: :foo do
# <injected by a macro>
scope as: false, alias: false do
resources "/bar", MyAppWeb.BarController, only: ~W[new create]a, as: :name
end
# </injected by a macro>
end
The generated route will have /foo/bar as HTTP path (path is still inherited from outer scopes) and the _path
function will be named name_path
as wished.