title: Edit mode, how to toggle between states
body: <p>I am following this guide: <a href="http://emberjs.com/guides/getting-started/toggle-todo-editing-state/" rel="nofollow">http://emberjs.com/guides/getting-started/toggle-todo-editing-state/</a></p>
  
  <p>So I wrote this code:</p>
  
  <pre><code>App.PostEditController = Ember.ObjectController.extend
    headerTitle: 'Editing post'
    buttonTitle: 'Edit'
  
    destroy: -&gt;
      @content.deleteRecord()
      @store.commit()
      @transitionToRoute('posts')
  
    save: -&gt;
      @content.save().then =&gt;
        @transitionToRoute('post', @content)
  
    cancel: -&gt;
      console.log("Canceling! " + @content)
      if @content.isDirty
        @content.rollback()
      @transitionToRoute('post', @content)
  </code></pre>
  
  <p>Post controller:</p>
  
  <pre><code>App.PostController = Ember.ObjectController.extend
    commentsVis: false
    isEditing: false
  
    showComments: () -&gt;
      this.set("commentsVis", true)
      @transitionToRoute('comments', post)
  
    editMode: -&gt;
      this.set("isEditing", true)
      @transitionToRoute('post.edit')
  </code></pre>
  
  <p>Routes</p>
  
  <pre><code>EmberJs.PostRoute = Ember.Route.extend
    model: (params) -&gt;
      App.Post.find(params.post_id)
    setupController: (controller, model) -&gt;
      controller.set('content', model)
      controller.set('isEditing', false)
  
  EmberJs.PostEditRoute = Ember.Route.extend
    model: (params) -&gt;
      App.Post.find(params.post_id)
    setupController: (controller, model) -&gt;
      controller.set('content', model)
  </code></pre>
  
  <p>Views:</p>
  
  <p>Post:</p>
  
  <pre><code>&lt;h1&gt;{{title}} / {{parseDate created}} by {{user.email}}&lt;/h1&gt;
  
  &lt;p&gt;{{body}}&lt;/p&gt;
  
  &lt;div id="discussion"&gt;
  {{#unless commentsVis}}
  &lt;a href="#" {{action 'showComments' this}}&gt;View discussion&lt;/a&gt;
  {{/unless}}
  &lt;/div&gt;
  
  {{outlet}}
  
  {{#unless isEditing}}
  &lt;button type="submit" {{action 'editMode'}}&gt;
      Edit
  &lt;/button&gt;
  {{/unless}}
  </code></pre>
  
  <p>Edit:</p>
  
  <pre><code>&lt;h1&gt;Edit Post&lt;/h1&gt;
  
  &lt;form&gt;
    &lt;div class="input string"&gt;
      &lt;label&gt;Title&lt;/label&gt;
      {{view Ember.TextField valueBinding='title' name='title' viewName='titleField'}}
    &lt;/div&gt;
    &lt;button type="submit" class="button" {{action save}}&gt;
      Edit
    &lt;/button&gt;
    &lt;button type="submit" class="button alert" {{action destroy}}&gt;
      Delete
    &lt;/button&gt;
  &lt;a href="#" {{action cancel}}&gt;Cancel&lt;/a&gt;
  &lt;/form&gt;
  
  {{outlet}}
  </code></pre>
  
  <p><strong>I have two issues:</strong></p>
  
  <ol>
  <li><p>When I click cancel, the right template is being loaded, isEditing is changed to false but still the Edit button is hidden.</p></li>
  <li><p>The line @transitionToRoute('post', @content) moves me to an undefined page, seems like @content isn't a model, but a DS.RecordArray. Yesterday it worked fine but seems like some other changes broke it. </p></li>
  </ol>
  
  <p>Thanks in advance, BBLN!</p>