RESTAdapter doesn't support links objects?

It looks like the latest JSON API spec defines links like this:

{   "posts": [{
    "id": "1",
    "title": "Rails is Omakase",
    "links": {
      "comments": {
        "href": "/posts/1/comments",
        "type": "comments"
      }
    }   
}] }

But the RESTAdapter in Ember-data Beta 11 expects the links to come as a string like this:

{   "posts": [{
    "id": "1",
    "title": "Rails is Omakase",
    "links": {
      "comments": "/posts/1/comments"
    }   
}] }

I’m currently overriding the findHasMany function (excuse the coffeescript):

DS.RESTAdapter.reopen
  findHasMany: (store, record, url, relationship) ->
    url = url.href
    this._super(store, record, url, relationship)

to get the correct url but it seems like this should be supported by now. Am I missing anything?

There’s also specs that have links like this:

{   "posts": [{
    "id": "1",
    "title": "Rails is Omakase",
    "links": {
      "comments": {
        "ids": [3,5,8]
        "href": "/comments/{id}",
        "type": "comments"
      }
    }   
}] }

I’m going to have to support this too, which again I can hack, but I’d really like to know if basic support for this is in the works. I do know that the latest canary build breaks when trying my findHasMany hack above. Any info would be greatly appreciated. Thanks!

1 Like