title: CakePHP: Unable to save associated model data (HasOne association)
body: <p>I have successful able to save data in User and Profile model, the problem is in the Profile table only id and user_id is getting inserted, remaining fields in the profile eg, email, city are NULL. Please help me in sorting this, Please find the codes below:</p>
  
  <p>Model:</p>
  
  <h2>user.php:</h2>
  
  <pre><code>class User extends AppModel {
  public $name = 'User';
  
  var $hasOne = array('Profile' =&gt;
                      array('className'    =&gt; 'Profile',
                            'conditions'   =&gt; '',
                            'order'        =&gt; '',
                            'dependent'    =&gt;  true,
                            'foreignKey'   =&gt; 'user_id'
                      )
                );
  .....
  </code></pre>
  
  <p>UsersController.php:</p>
  
  <pre><code>class UsersController extends AppController {
  .....
  public function add() {
      if ($this-&gt;request-&gt;is('post')) {
          $this-&gt;User-&gt;create();
          if ($this-&gt;User-&gt;save($this-&gt;request-&gt;data)) {
              if (!empty($this-&gt;request-&gt;data)) {
                  $this-&gt;request-&gt;data['Profile']['user_id'] = $this-&gt;User-&gt;id;
                  $this-&gt;User-&gt;Profile-&gt;save($this-&gt;request-&gt;data);
              }
              $this-&gt;Session-&gt;setFlash(__('The user has been saved'));
              $this-&gt;redirect(array('controller' =&gt; 'homes','action' =&gt; 'index'));
          } else {
              $this-&gt;Session-&gt;setFlash(__('The user could not be saved. Please, try again.'));
          }
      }
  }
  </code></pre>
  
  <p>View: add.ctp</p>
  
  <pre><code>            &lt;?php echo $this-&gt;Form-&gt;create('User' , array('action' =&gt; 'add'));?&gt;
              &lt;fieldset&gt;
                  &lt;?php
                      echo $this-&gt;Form-&gt;input('username');
                      echo $this-&gt;Form-&gt;input('password');
                      echo $this-&gt;Form-&gt;input('profile.firstname');
                      echo $this-&gt;Form-&gt;input('profile.lastname');
                      echo $this-&gt;Form-&gt;input('profile.email');
                  ?&gt;
              &lt;/fieldset&gt;
              &lt;?php echo $this-&gt;Form-&gt;end(__('Submit'));?&gt;
  </code></pre>
  
  <p>Model: Profile.php:</p>
  
  <pre><code>class Profile extends AppModel {
  public $name = 'Profile';
  var $belongsTo = array('User' =&gt;
                         array('className'  =&gt; 'User',
                               'conditions' =&gt; '',
                               'order'      =&gt; '',
                               'foreignKey' =&gt; 'user_id'
                         )
                   );
  ....
  </code></pre>
  
  <p>Please help.</p>
  
  <p>Thanks in advance!!!</p>