I'm trying to create a button that makes a given user an admin. For that I'd like to create a route for the request post /users/:id/admin
. In order to do that, I'm trying to create a nested resource like so:
resources "/users", UserController, only: [:new, :create, :index] do
resources "/admin", UserController, only: [:post]
end
But when I run mix phx.routes | grep users
, I only get those routes:
user_path GET /users StorexWeb.UserController :index
user_path GET /users/new StorexWeb.UserController :new
user_path POST /users StorexWeb.UserController :create
As if the nested resource was not declared. What is wrong with my resource declaration ? and how can I fix it ?