title: Change a changeset
body: <p>I don't understand how I can change the values of a given changeset.</p>
  
  <h2>Setup</h2>
  
  <pre><code>mix phoenix.new shop
  cd shop
  mix ecto.create
  mix phoenix.gen.html Product products name price:integer
  mix ecto.migrate
  </code></pre>
  
  <p><strong>web/router.ex</strong></p>
  
  <pre class="lang-erlang prettyprint-override"><code>[...]
  scope "/", Shop do
    pipe_through :browser # Use the default browser stack
  
    get "/", PageController, :index
    resources "/products", ProductController
  end
  [...]
  </code></pre>
  
  <h2>The Problem</h2>
  
  <p>I start the IEX and create a new changeset:</p>
  
  <pre class="lang-erlang prettyprint-override"><code>iex -S mix phoenix.server
  iex(1)&gt; alias Shop.Product
  iex(2)&gt; changeset = Product.changeset(%Product{price: 1})
  #Ecto.Changeset&lt;action: nil, changes: %{},
   errors: [name: {"can't be blank", [validation: :required]}],
   data: #Shop.Product&lt;&gt;, valid?: false&gt;
  </code></pre>
  
  <p>How can I change that given changeset now? The following code doesn't work:</p>
  
  <pre class="lang-erlang prettyprint-override"><code>iex(3)&gt; changeset = Product.changeset(changeset, %{name: "Orange"})
  #Ecto.Changeset&lt;action: nil, changes: %{name: "Orange"},
   errors: [name: {"can't be blank", [validation: :required]}],
   data: #Shop.Product&lt;&gt;, valid?: false&gt;
  </code></pre>
  
  <p>Because of the errors I can't do a <code>Shop.Repo.insert(changeset)</code> now.</p>
  
  <p>I know that in this specific example I could change the iex(2) line to get the changeset I want. But I'd like to know how to manipulate a changeset after it's been created.</p>