DS.Adapter#updateRecord()

updateRecord (store, type, snapshot) Promise Defined in addon/adapter.js:322 Implement this method in a subclass to handle the updating of a record. Serializes the record update and sends it to the server. The updateRecord method is expected to return a promise that will resolve with the serialized record. This allows the backend to inform the Ember Data store the current state of this record after the update. If it is not possible to return a serialized record the updateRecord promise can

DS.Adapter#shouldReloadRecord()

shouldReloadRecord (store, snapshot) Boolean Defined in addon/adapter.js:479 Available since 1.13.0 This method is used by the store to determine if the store should reload a record from the adapter when a record is requested by store.findRecord. If this method returns true, the store will re-fetch a record from the adapter. If this method returns false, the store will resolve immediately using the cached record. For example, if you are building an events ticketing system, in which users ca

DS.Adapter#shouldReloadAll()

shouldReloadAll (store, snapshotRecordArray) Boolean Defined in addon/adapter.js:527 Available since 1.13.0 This method is used by the store to determine if the store should reload all records from the adapter when records are requested by store.findAll. If this method returns true, the store will re-fetch all records from the adapter. If this method returns false, the store will resolve immediately using the cached records. For example, if you are building an events ticketing system, in wh

DS.Adapter#shouldBackgroundReloadRecord()

shouldBackgroundReloadRecord (store, snapshot) Boolean Defined in addon/adapter.js:580 Available since 1.13.0 This method is used by the store to determine if the store should reload a record after the store.findRecord method resolves a cached record. This method is only checked by the store when the store is returning a cached record. If this method returns true the store will re-fetch a record from the adapter. For example, if you do not want to fetch complex data over a mobile connection

DS.Adapter#shouldBackgroundReloadAll()

shouldBackgroundReloadAll (store, snapshotRecordArray) Boolean Defined in addon/adapter.js:619 Available since 1.13.0 This method is used by the store to determine if the store should reload a record array after the store.findAll method resolves with a cached record array. This method is only checked by the store when the store is returning a cached record array. If this method returns true the store will re-fetch all records from the adapter. For example, if you do not want to fetch comple

DS.Adapter#serialize()

serialize (snapshot, options) Object Defined in addon/adapter.js:255 Proxies to the serializer's serialize method. Example app/adapters/application.js import DS from 'ember-data'; export default DS.Adapter.extend({ createRecord: function(store, type, snapshot) { var data = this.serialize(snapshot, { includeId: true }); var url = `/${type.modelName}`; // ... } }); Parameters: snapshot DS.Snapshot options Object Returns: Object serialized snapshot

DS.Adapter#queryRecord()

queryRecord (store, type, query) Promise Defined in addon/adapter.js:184 The queryRecord() method is invoked when the store is asked for a single record through a query object. In response to queryRecord() being called, you should always fetch fresh data. Once found, you can asynchronously call the store's push() method to push the record into the store. Here is an example queryRecord implementation: Example app/adapters/application.js import DS from 'ember-data'; import Ember from 'ember';

DS.Adapter#query()

query (store, type, query, recordArray) Promise Defined in addon/adapter.js:154 This method is called when you call query on the store. Example app/adapters/application.js import DS from 'ember-data'; export default DS.Adapter.extend({ query: function(store, type, query) { return new Ember.RSVP.Promise(function(resolve, reject) { Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) { resolve(data); }, function(jqXHR) { reject(jqXHR); });

DS.Adapter#groupRecordsForFindMany()

groupRecordsForFindMany (store, snapshots) Array Defined in addon/adapter.js:459 Organize records into groups, each of which is to be passed to separate calls to findMany. For example, if your api has nested URLs that depend on the parent, you will want to group records by their parent. The default implementation returns the records as a single group. Parameters: store DS.Store snapshots Array Returns: Array an array of arrays of records, each of which is to be loaded separatel

DS.Adapter#generateIdForRecord()

generateIdForRecord (store, type, inputProperties) (String|Number) Defined in addon/adapter.js:221 If the globally unique IDs for your records should be generated on the client, implement the generateIdForRecord() method. This method will be invoked each time you create a new record, and the value returned from it will be assigned to the record's primaryKey. Most traditional REST-like HTTP APIs will not use this method. Instead, the ID of the record will be set by the server, and your adapt