DS.Store#modelFor()

modelFor (modelName) DS.Model Defined in addon/-private/system/store.js:1921 Returns the model class for the particular modelName. The class of a model might be useful if you want to get a list of all the relationship names of the model, see relationshipNames for example. Parameters: modelName String Returns: DS.Model

Enumerable#contains()

contains (obj) Booleandeprecatedpublic Defined in packages/ember-runtime/lib/mixins/enumerable.js:217 Use Enumerable#includes instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains Returns true if the passed object can be found in the receiver. The default version will iterate through the enumerable until the object is found. You may want to override this with a more efficient version. let arr = ['a', 'b', 'c']; arr.contains('a'); // true arr.contains('z'); // false

DS.Store#didUpdateAll()

didUpdateAll (typeClass) private Defined in addon/-private/system/store.js:1462 Parameters: typeClass DS.Model

DS.RESTAdapter#queryRecord()

queryRecord (store, type, query) Promise Inherited from DS.Adapter but overwritten in addon/adapters/rest.js:511 Available since 1.13.0 Called by the store in order to fetch a JSON object for the record that matches a particular query. The queryRecord method makes an Ajax (HTTP GET) request to a URL computed by buildURL, and returns a promise for the resulting payload. The query argument is a simple JavaScript object that will be passed directly to the server as parameters. Parameters: s

DS.Model.typeForRelationship()

typeForRelationship (name, store) DS.Modelstatic Defined in addon/-private/system/relationships/ext.js:161 For a given relationship name, returns the model type of the relationship. For example, if you define a model like this: app/models/post.js import DS from 'ember-data'; export default DS.Model.extend({ comments: DS.hasMany('comment') }); Calling App.Post.typeForRelationship('comments') will return App.Comment. Parameters: name String the name of the relationship store Store

DS.RESTSerializer#normalize()

normalize (modelClass, resourceHash, prop) Object Inherited from DS.JSONSerializer but overwritten in addon/serializers/rest.js:91 Normalizes a part of the JSON payload returned by the server. You should override this method, munge the hash and call super if you have generic normalization to do. It takes the type of the record that is being normalized (as a DS.Model class), the property where the hash was originally found, and the hash to normalize. For example, if you have a payload that l

DS.RESTSerializer#pushPayload()

pushPayload (store, payload) Defined in addon/serializers/rest.js:380 This method allows you to push a payload containing top-level collections of records organized per type. { "posts": [{ "id": "1", "title": "Rails is omakase", "author", "1", "comments": [ "1" ] }], "comments": [{ "id": "1", "body": "FIRST" }], "users": [{ "id": "1", "name": "@d2h" }] } It will first normalize the payload, so you can use this to push in data streaming in from y

DS.Model.relationshipsByName

relationshipsByNameEmber.Mapstatic Defined in addon/-private/system/relationships/ext.js:450 A map whose keys are the relationships of a model and whose values are relationship descriptors. For example, given a model with this definition: app/models/blog.js import DS from 'ember-data'; export default DS.Model.extend({ users: DS.hasMany('user'), owner: DS.belongsTo('user'), posts: DS.hasMany('post') }); This property would contain the following: import Ember from 'ember'; import Blo

Creating, Updating and Deleting

Creating, Updating and Deleting Creating Records You can create records by calling the createRecord() method on the store. store.createRecord('post', { title: 'Rails is Omakase', body: 'Lorem ipsum' }); The store object is available in controllers and routes using this.get('store'). Updating Records Making changes to Ember Data records is as simple as setting the attribute you want to change: this.get('store').findRecord('person', 1).then(function(tyrion) { // ...after the record has l

Enumerable#compact()

compactArraypublic Defined in packages/ember-runtime/lib/mixins/enumerable.js:774 Returns a copy of the array with all null and undefined elements removed. let arr = ['a', null, 'c', undefined]; arr.compact(); // ['a', 'c'] Returns: Array the array without null and undefined elements.