DS.RESTAdapter#findBelongsTo()

findBelongsTo (store, snapshot, url) Promise

Defined in addon/adapters/rest.js:648

Called by the store in order to fetch the JSON for the unloaded record in a belongs-to relationship that was originally specified as a URL (inside of links).

For example, if your original payload looks like this:

{
  "person": {
    "id": 1,
    "name": "Tom Dale",
    "links": { "group": "/people/1/group" }
  }
}

This method will be called with the parent record and /people/1/group.

The findBelongsTo method will make an Ajax (HTTP GET) request to the originally specified URL.

The format of your links value will influence the final request URL via the urlPrefix method:

  • Links beginning with //, http://, https://, will be used as is, with no further manipulation.

  • Links beginning with a single / will have the current adapter's host value prepended to it.

  • Links with no beginning / will have a parentURL prepended to it, via the current adapter's buildURL.

Parameters:

store DS.Store
snapshot DS.Snapshot
url String

Returns:

Promise
promise
doc_EmberJs
2016-11-30 16:50:28
Comments
Leave a Comment

Please login to continue.