Ember data beta manage state


#1

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)

#2

Which version of ember-data are you using?


#3

The current beta of ember-data.


#4

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.


#5

1.0.0b1

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


#6

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);

#7

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