thanks for the feedback @hlx, that would also be my guess. I looked at the changesets closer: changeset.data.__meta__ has :loaded or :built that should affect the verb
I am using the generated boilerplate code with Phoenix 1.4 and changed my schema to an embedded schema. The result is, that the form_for function generates a POST and not a PUT request.
What do I have to adjust on the changeset so it generates a PUT request?
The generated code uses the same form code for both new and edit pages, And as Chris said in the linked issue comment, the form_for should handle the method automatically based on the changeset. But that doesn’t work out of the box with embedded schemas.
It only works automatically for changesets of db stored schemas, because they keep track of being loaded from the db or being created at runtime. Embedded schemas don’t do that so you need to fall back to the options phoenix provides without the automation of the phoenix_ecto implementation.
Long ago I read somewhere that there just needs to be something set on the changeset for it to work. But I cannot find it anymore and it’s not in any of the official documentation.
It’s part of the metadata of schema structs, but the necessary field is not available for embedded schemas, so you cannot set it manually. I’d also argue that it’s just an implementation detail and I’d much rather use just the options of phoenix and not something only used by ecto schemas.