title: Cakephp - Saving related models
body: <p>I have the following relationships between my models:</p>
  
  <pre><code>Assignment hasMany Question
  Question belongsTo Assignment
  Question hasMany Answer
  Answer belongsTo Question
  </code></pre>
  
  <p>I would like to have a single form that can save the assignment, the questions, and the answers. </p>
  
  <p>The form is almost working, it saves the assignment information and the questions, but not the answers.</p>
  
  <p>Assignments Controller Create action:</p>
  
  <pre><code>function create() {
          if (!empty($this-&gt;data)) {
  
          var_dump($this-&gt;data);
  
          unset($this-&gt;Assignment-&gt;Question-&gt;validate['assignment_id']);
          unset($this-&gt;Assignment-&gt;Question-&gt;Answer-&gt;validate['question_id']);
          $this-&gt;Assignment-&gt;saveAll($this-&gt;data, array('validate' =&gt; 'first'));
      }
  }
  </code></pre>
  
  <p>create.ctp</p>
  
  <pre><code>Create new assignment
  &lt;?php
  
  echo $this-&gt;Form-&gt;create('assignment', array('action' =&gt; 'create'));
  echo $this-&gt;Form-&gt;input('Assignment.title');
  echo $this-&gt;Form-&gt;input('Assignment.type');
  echo $this-&gt;Form-&gt;input('Question.0.question');
  echo $this-&gt;Form-&gt;input('Question.0.Answer.0.answer');
  echo $this-&gt;Form-&gt;end('Create');
  
  ?&gt;
  </code></pre>