createRecord (modelName, inputProperties) DS.Model
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
Please login to continue.