{"action":"created","issue":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/2053","repository_url":"https://api.github.com/repos/phoenixframework/phoenix","labels_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/2053/labels{/name}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/2053/comments","events_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/2053/events","html_url":"https://github.com/phoenixframework/phoenix/issues/2053","id":198267941,"number":2053,"title":"Phoenix.gen.html should generate put/patch for edit updates. no route found for POST /users/1","user":{"login":"nico-amsterdam","id":16443840,"avatar_url":"https://avatars.githubusercontent.com/u/16443840?v=3","gravatar_id":"","url":"https://api.github.com/users/nico-amsterdam","html_url":"https://github.com/nico-amsterdam","followers_url":"https://api.github.com/users/nico-amsterdam/followers","following_url":"https://api.github.com/users/nico-amsterdam/following{/other_user}","gists_url":"https://api.github.com/users/nico-amsterdam/gists{/gist_id}","starred_url":"https://api.github.com/users/nico-amsterdam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nico-amsterdam/subscriptions","organizations_url":"https://api.github.com/users/nico-amsterdam/orgs","repos_url":"https://api.github.com/users/nico-amsterdam/repos","events_url":"https://api.github.com/users/nico-amsterdam/events{/privacy}","received_events_url":"https://api.github.com/users/nico-amsterdam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-01-01T13:53:07Z","updated_at":"2017-01-01T15:13:57Z","closed_at":null,"body":"Maybe in the past it was allowed to use POST for updates, but now that doesn't work anymore.\r\nI use Elixir 1.3, Phoenix 1.2, Phoenix_html 2.9.1, Ubuntu 16.04\r\nThe command used to generate:\r\n   mix phoenix.gen.html User users name address date_of_birth:datetime number_of_children:integer notifications_enabled:boolean\r\n\r\nIn router.ex, I added: resources \"/users\", UserController\r\nNotice that there is NO user_path POST /users/:id in my phoenix.routes:\r\n\r\n                 user_path  GET     /users                               PhoenixExample.UserController :index\r\n                 user_path  GET     /users/:id/edit                      PhoenixExample.UserController :edit\r\n                 user_path  GET     /users/new                           PhoenixExample.UserController :new\r\n                 user_path  GET     /users/:id                           PhoenixExample.UserController :show\r\n                 user_path  POST    /users                               PhoenixExample.UserController :create\r\n                 user_path  PATCH   /users/:id                           PhoenixExample.UserController :update\r\n                            PUT     /users/:id                           PhoenixExample.UserController :update\r\n                 user_path  DELETE  /users/:id                           PhoenixExample.UserController :delete\r\n\r\nCreating a new user works, but when edit is selected, a 'no route found for POST /users/1' is thrown when you push the submit button.\r\nOf course the HTML form cannot use PUT, PATCH, DELETE, but there is a hidden _method field that should be filled with the intended method.\r\n\r\nMY FIX:\r\n------\r\nAfter generating I changed web/templates/user/form.html.eex line 1:\r\n<%= form_for @changeset, @action, @options, fn f -> %>\r\n\r\nin edit.html.eex the options parameters is added:\r\n<%= render \"form.html\", changeset: @changeset,\r\naction: user_path(@conn, :update, @user),\r\noptions: [method: \"put\"] %>  <!-- PUT method -->\r\n\r\nand in new.html.eex the options parameters is added:\r\n<%= render \"form.html\", changeset: @changeset,\r\naction: user_path(@conn, :create),\r\noptions: [method: \"post\"] %>\r\n\r\n----\r\nI kindly request to change your generator templates."},"comment":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/comments/269906624","html_url":"https://github.com/phoenixframework/phoenix/issues/2053#issuecomment-269906624","issue_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/2053","id":269906624,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2017-01-01T15:13:57Z","updated_at":"2017-01-01T15:13:57Z","body":"Phoenix never allowed to use POST for updates. We automatically figure it out based on changeset. So either the data being given to the changeset did not come from the database or there is something else happening. An application that reproduces the error would help us investigate this."}}
{"actor":{"display_login":"josevalim"}}