DS.Store#reloadRecord()

reloadRecord (internalModel) Promiseprivate Defined in addon/-private/system/store.js:942 This method is called by the record's reload method. This method calls the adapter's find method, which returns a promise. When that promise resolves, reloadRecord will resolve the promise returned by the record's reload. Parameters: internalModel DS.Model Returns: Promise promise

DS.Store#recordWasInvalid()

recordWasInvalid (internalModel, errors) private Defined in addon/-private/system/store.js:1771 This method is called once the promise returned by an adapter's createRecord, updateRecord or deleteRecord is rejected with a DS.InvalidError. Parameters: internalModel InternalModel errors Object

DS.Store#recordWasError()

recordWasError (internalModel, error) private Defined in addon/-private/system/store.js:1785 This method is called once the promise returned by an adapter's createRecord, updateRecord or deleteRecord is rejected (with anything other than a DS.InvalidError). Parameters: internalModel InternalModel error Error

DS.Store#recordIsLoaded()

recordIsLoaded (modelName, id) Boolean Defined in addon/-private/system/store.js:1637 This method returns if a certain record is already loaded in the store. Use this function to know beforehand if a findRecord() will result in a request or that it will be a cache hit. Example store.recordIsLoaded('post', 1); // false store.findRecord('post', 1).then(function() { store.recordIsLoaded('post', 1); // true }); Parameters: modelName String id String Returns: Boolean

DS.Store#recordForId()

recordForId (modelName, id) DS.Modelprivate Defined in addon/-private/system/store.js:983 Returns id record for a given type and ID. If one isn't already loaded, it builds a new record and leaves it in the empty state. Parameters: modelName String id (String|Integer) Returns: DS.Model record

DS.Store#queryRecord()

queryRecord (modelName, query) Promise Defined in addon/-private/system/store.js:1151 Available since 1.13.0 This method makes a request for one record, where the id is not known beforehand (if the id is known, use findRecord instead). This method can be used when it is certain that the server will return a single object for the primary data. Let's assume our API provides an endpoint for the currently logged in user via: // GET /api/current_user { user: { id: 1234, username: 'admi

DS.Store#query()

query (modelName, query) Promise Defined in addon/-private/system/store.js:1076 Available since 1.13.0 This method delegates a query to the adapter. This is the one place where adapter-level semantics are exposed to the application. Exposing queries this way seems preferable to creating an abstract query language for all server-side queries, and then require all adapters to implement them. If you do something like this: store.query('person', { page: 1 }); The call made to the server, usin

DS.Store#pushPayload()

pushPayload (modelName, inputPayload) Defined in addon/-private/system/store.js:2197 Push some raw data into the store. This method can be used both to push in brand new records, as well as to update existing records. You can push in more than one type of object at once. All objects should be in the format expected by the serializer. app/serializers/application.js import DS from 'ember-data'; export default DS.ActiveModelSerializer; var pushData = { posts: [ { id: 1, post_title: "G

DS.Store#push()

push (data) DS.Model|Array Defined in addon/-private/system/store.js:1962 Push some data for a given type into the store. This method expects normalized JSON API document. This means you have to follow JSON API specification with few minor adjustments: - record's type should always be in singular, dasherized form - members (properties) should be camelCased Your primary data should be wrapped inside data property: store.push({ data: { // primary data for single record of type `Person`

DS.Store#peekRecord()

peekRecord (modelName, id) DS.Model|null Defined in addon/-private/system/store.js:910 Available since 1.13.0 Get a record by a given type and ID without triggering a fetch. This method will synchronously return the record if it is available in the store, otherwise it will return null. A record is available if it has been fetched earlier, or pushed manually into the store. Note: This is an synchronous method and does not return a promise. var post = store.peekRecord('post', 1); post.get('i