-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use to_form :action as changeset action when passed #171
Conversation
Note this will require changing the mix.exs entry to:
Assuming we are launching phoenix_html v4.1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the existing action here
lib/phoenix_ecto/html.ex
Outdated
{action, changeset} = | ||
case Keyword.fetch(opts, :action) do | ||
{:ok, action} -> {action, Map.put(changeset, :action, action)} | ||
:error -> {nil, changeset} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:error -> {nil, changeset} | |
:error -> {changeset.action, changeset} |
lib/phoenix_ecto/html.ex
Outdated
{action, changeset} = | ||
case Keyword.fetch(opts, :action) do | ||
{:ok, action} -> {action, Map.put(changeset, :action, action)} | ||
:error -> {nil, changeset} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{action, changeset} = | |
case Keyword.fetch(opts, :action) do | |
{:ok, action} -> {action, Map.put(changeset, :action, action)} | |
:error -> {nil, changeset} | |
end | |
{action, opts} = Keyword.pop_lazy(opts, :action, fn -> changeset.action end) |
lib/phoenix_ecto/html.ex
Outdated
@@ -11,6 +17,7 @@ if Code.ensure_loaded?(Phoenix.HTML) do | |||
source: changeset, | |||
impl: __MODULE__, | |||
id: id, | |||
action: action, | |||
name: name, | |||
errors: form_for_errors(changeset), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors: form_for_errors(changeset), | |
errors: form_for_errors(action, changeset), |
ref:
phoenixframework/phoenix_html#439
phoenixframework/phoenix_live_view#3090
phoenixframework/phoenix#5713