title: What is the best way to validate a nested model with Phoenix?
body: <p>Coming from a <a href="/questions/tagged/laravel" class="post-tag" title="show questions tagged &#39;laravel&#39;" rel="tag">laravel</a> background,  I often find myself composing <em>Form Requests</em> to validate nested models.</p>
  
  <p>In my case, I have a <em>Model</em> which has many (1..*) <em>NestedModel</em>.  <em>Model</em> MUST be created with <em>NestedModel</em>.  The payload I receive looks like so:</p>
  
  <pre><code>{
      "model": {
          "nested_model": {
              // ...
          },
          // ...
      }
  }
  </code></pre>
  
  <p>The only time the <em>NestedModel</em> is required in the <em>Model</em>'s payload is on my <em>ModelController@create</em> endpoint.  <em>NestedModel</em>s have their own endpoints.</p>
  
  <p>How would I go around implementing this with <em>changeset</em>s since I would like to validate my payload first and then save both models to my database?</p>