I’m working though the rumbl example in the Programming Phoenix 1.4 book. I added the user and credential code to an example new app and it’s working fine. I decided to add the ability to edit a user, which isn’t part of the rumbl code examples.
I removed the original “only: [:index, :show, :new, :create]” constraints for “/users” in the router, created the edit template and added edit and update functions to usercontroller.ex (taken from another app that used phx.gen.html to add user functionality).
When I try to load the edit page, I get this error:
ArgumentError at GET /users/1/edit
no action :update for helper MyappWeb.Router.Helpers.user_path/2.
The following actions/clauses are supported:
user_path(conn_or_endpoint, :create, params \ )
user_path(conn_or_endpoint, :delete, id, params \ )
user_path(conn_or_endpoint, :edit, id, params \ )
user_path(conn_or_endpoint, :index, params \ )
user_path(conn_or_endpoint, :new, params \ )
user_path(conn_or_endpoint, :show, id, params \ )
user_path(conn_or_endpoint, :update, id, params \ )[lib/phoenix/router/helpers.ex]
The routes list seems to indicate the update function that’s referenced in the edit template action is valid. I have an update function in the controller.
Does this necessarily mean I need to add something to lib/phoenix/router/helpers.ex?