Ember data beta manage state


Is it possible to set the state of an Ember data model to saved manually? Right now I’m manually trying to authenticate using a post request where it returns the json for a user. I want to do something as follows:

$.post('login', username: 'bob', password: 'dole').then (resp) =>
  user = App.User.createRecord(resp.user)
  # TODO: set user state to saved instead of isNew
  @set('currentUser', user)


Which version of ember-data are you using?


The current beta of ember-data.


Both 0.13 and 1.0.0b1 could be considered the current beta :stuck_out_tongue: You can see the exact version in the console when your app launches.



the following words are because discuss won’t let me post less than 20 characters :frowning:


This is not the right way to sideload data into the store. You need to use store.push not createRecord:

this.store.push('user', resp.user);


My bad, should be pushPayload() for data that needs serialising, push() for already normalised.