Redirect back with changeset <p>i'm working with programming phoenix book examples more specific:</p> <pre><code>def create(conn, %{"user" =&gt; user_params}) do changeset = User.registration_changeset(%User{}, user_params) case Repo.insert(changeset) do {:ok, user} -&gt; conn |&gt; put_flash(:info, "#{user.username} created!") |&gt; redirect(to: user_path(conn, :index)) {:error, changeset} -&gt; render(conn, "new.html", changeset: changeset) end end </code></pre> <p>when the form has errors instead of using <code>render(conn, "new.html", changeset: changeset)</code></p> <p>i want to redirect back with changeset the following code works:</p> <pre><code>{:error, changeset} -&gt; conn |&gt; put_flash(:error, "Error") |&gt; redirect(to: user_path(conn, :new)) </code></pre> <p>but it doesn't contains the changeset which is important i think.Another thing is that instead of render users/new it renders users route.</p> <p>Any ideas?</p>