title: Edit in CakePHP creates new entry instead of updating old one
body: <p>I tried to follow the CakePHP blog tutorial (<a href="http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html" rel="nofollow">http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html</a>) and everything works fine, except for the edit method. The edit function as specified in the tutorial seems to work, but instead of updating the old entry, it creates a new entry in the database. (But says that it did update the old entry with the "Jop was updated" message)</p>
  
  <p>My source files are:</p>
  
  <p><strong>edit.ctp</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;!-- File: /app/View/Jobs/edit.ctp --&gt;
  &lt;h1&gt;Edit Job&lt;/h1&gt;
  
  &lt;?php
  echo $this-&gt;Form-&gt;create('Job');
  echo $this-&gt;Form-&gt;input('type');
  echo $this-&gt;Form-&gt;input('name');
  echo $this-&gt;Form-&gt;input('company');
  echo $this-&gt;Form-&gt;input('id', array('type' =&gt; 'hidden'));
  echo $this-&gt;Form-&gt;end('Save Job');
  ?&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>JobsController.php</strong>
      
  
  <pre><code>class JobsController extends AppController 
      {
      public $helpers = array('Html', 'Form', 'Session');
      public $components = array('Session');
  
      public function index() 
      {
          $this-&gt;set('jobs', $this-&gt;Job-&gt;find('all'));
      }
  
      public function view($id=null) {
          if (!$id) 
          {
              throw new NotFoundException(__('Invalid job'));
          }
  
          $job = $this-&gt;Job-&gt;findById($id);
          if (!$job) 
          {
              throw new NotFoundException(__('Invalid job'));
          }
          $this-&gt;set('job', $job);
      }
  
      public function add() {
          if ($this-&gt;request-&gt;is('POST')) {
              $this-&gt;Job-&gt;create();
              if ($this-&gt;Job-&gt;save($this-&gt;request-&gt;data)) 
              {
                  $this-&gt;Session-&gt;setFlash(__('Your job has been saved.'));
                  return $this-&gt;redirect(array('action' =&gt; 'index'));
              }
              $this-&gt;Session-&gt;setFlash('Unable to add your job.');
          }
      }
  
      public function edit($id=null) {
          if (!$id) {
              throw new NotFoundException(__('Invalid job'));
          }
  
          $job = $this-&gt;Job-&gt;findById($id);
  
          if (!$job) {
              throw new NotFoundException(__('Invalid job'));
          }
  
          if ($this-&gt;request-&gt;is(array ('POST', 'PUT'))) {
              $this-&gt;Job-&gt;id = $id; 
  
              if ($this-&gt;Job-&gt;save($this-&gt;request-&gt;data)) {           
                  $this-&gt;Session-&gt;setFlash(__('Job has been updated.'));
                  return $this-&gt;redirect(array('action' =&gt; 'index'));
              }
              else {
                   $this-&gt;Session-&gt;setFlash(__('Unable to update the job.'));
              }
  
              if (!$this-&gt;request-&gt;data) {
                  $this-&gt;request-&gt;data = $job;
              }
  
          }
      }
  
      public function delete($id) {
          if (!$id) {
              throw new NotFoundException(__('Invalid job'));
          }
  
          if ($this-&gt;request-&gt;is('GET')) {
              throw new MethodNotAllowedException();
          }
  
          if ($this-&gt;Job-&gt;delete($id)) {
              $this-&gt;Session-&gt;setFlash(__('Job has been deleted.'));
          }
          else {
              $this-&gt;Session-&gt;setFlash(__('Unable to delete job.'));
          }
  
          return $this-&gt;redirect(array('action' =&gt; 'index'));
      }
  }
  
  ?&gt;
  </code></pre>