User/edit.html.eex:1: undefined function user_path/2

Hi I’m new to Elixir. I have a following routes generated in my project:
user_path GET /user/:id/show appName.Html.UserController :show
user_path GET /user/:id/edit appName.Html.UserController :edit
user_path PUT /user/:id/update appName.Html.UserController :update_user

From the above UserController ‘:edit’ action I want to redirect to ‘:update_user’ action from a template. so, I’m using form tag like below.

  [<form method="PUT", action="<%= user_path(@conn, :update_user) %>">
  </form>](http://FORM TAG)

But I’m getting error like > (CompileError) web/templates/html/user/edit.html.eex:1: undefined function user_path/2

But I have user_path route generated. What mistake i have made here. Thank You


Welcome to the forum :slight_smile: Hope you’ll like playing with Elixir.

The error you’re experiencing is caused by the user_path method requiring an id (see the PUT action `/user/:id/update’).

Your action should point to user_path(@conn, :update_user, where @user is the user being edited

Hope this helps.

Take care


Thank You Soo Much :smile: