title: Temporary Non-Persistent Record with Ember-Data 1.0.0-beta
body: <p>I'm new to Ember and Ember-data and am deciding whether to use Ember-Data or one of the other persistence libraries. In order to evaluate, I'm experimenting with writing a small Rails-backed app.</p>
  
  <p>One of my routes can be considered similar to the Todo MVC app that is frequently used in examples.</p>
  
  <p>In my template, I have a number of input fields that represent attributes within the model. Furthermore, I also have one element in the model that represents a hasMany relationship.</p>
  
  <p><strong>Models:</strong></p>
  
  <pre><code>App.CompanyModel = DS.Model.extend
     company: DS.attr()
     desc: DS.attr()
     contacts:  DS.hasMany('company_contact')
  
  App.CompanyContactModel = DS.Model.extend
     firstname: DS.attr()
     lastname: DS.attr()
     ...
  </code></pre>
  
  <p>Within my controller, I want to be able to create a new CompanyModel record (and by virtue, add one or more contacts models to it), but not have it appear within the controller's instance of the CompanyModel until I'm ready to do so.</p>
  
  <p>Currently, when a user wants to add a new record, I have a component that calls an action in my controller as follows:</p>
  
  <pre><code>@set('new_company',
    @store.createRecord('company')
  )
  </code></pre>
  
  <p>This actually works fine, except for one thing. My view has to populate the individual attributes within "new_company", which it does, however, the record is immediately added to the controller's model instance and appears in the list of records; I only want the newly created record to be visible in the table once a particular action has taken place.</p>
  
  <p>Instead of instantiating new_company with createRecord, I could do something like this:</p>
  
  <pre><code>@set('new_company',
    Ember.Object.create
      companyname: ''
      desc: ''
      contacts: [
        firstname: ''
        lastname: ''
      ]
  )
  </code></pre>
  
  <p>And then do a @store.createRecord('company', @get('new_company')), however, given I've already defined my attributes in the model, it doesn't feel very DRY to me.</p>
  
  <p>I'm using Ember 1.5.0 and Ember-Data 1.0.0-beta.7.</p>
  
  <p>It appears I'm not the first person to have this issue (<a href="https://stackoverflow.com/questions/9992652/create-temporarty-non-persistent-object-in-ember-data">create temporarty non persistent object in Ember-Data</a>), but it appears that Ember-Data has sufficiently changed to make all of these solutions inoperable.</p>
  
  <p>Thanks for your help!</p>