DS.Store#createRecord()

createRecord (modelName, inputProperties) DS.Model

Defined in addon/-private/system/store.js:298

Create a new record in the current store. The properties passed to this method are set on the newly created record.

To create a new instance of a Post:

store.createRecord('post', {
  title: "Rails is omakase"
});

To create a new instance of a Post that has a relationship with a User record:

var user = this.store.peekRecord('user', 1);
store.createRecord('post', {
  title: "Rails is omakase",
  user: user
});

Parameters:

modelName String
inputProperties Object
a hash of properties to set on the newly created record.

Returns:

DS.Model
record
doc_EmberJs
2016-11-30 16:50:46
Comments
Leave a Comment

Please login to continue.