Why are my response-relationships not recognized as relationship?

Hello,

I’m actually fresh to a new company and would like to “professionalize” their product from un-maintainable some-very-large-few-single-files-PHP project, over, to a maintainable, JSONAPI based resolution build upon Ember on client side, and Node/Express on server side.

My experience is based at least on two years of full-time node.js experience and about a year of angular before the dive-into node.js-backends. Actually I’m struggling around, with JSONAPI-compatible relationships.

I’ve tried to show you in a lighten version, what I’m done until now here: Ember Twiddle (just look at the sources – not at the resulting html on the right side)

I’m trying to establish a connection between two models: bank and user. While the user has a belongsTo bank-id (/bankId), the bank does not has a inverse relationship.

The JSON, my API responds with actually, is there: https://gist.github.com/iamsebastian/9afad6bc56fcede54e6b

As you can see, the user has a bank-id which I actually deserialize to {bank-id -> bank}, so ember-data get’s knowledge about, which models have to be connected here.

Now the question:
All is working well, if I send out the bank-id as user’s attribute. But ember-data does not connect the two models, if I do not send out the bank-id property. But as far as I could read from the JSONAPI specification and the ember docs, the belongsTo-relationship between bank & user should be already established in because of this part of the response:

https://gist.github.com/iamsebastian/9afad6bc56fcede54e6b#file-users_response-json-L83-L93

The data is correctly parsed by ember and the adapters, like you will see here: screenshot from 2015-12-09 16-04-04

Feel free to ask me anything about that, if it would help to let you understand my question.

Another awkward question:
I also could not get ember-data to “auto-request” missing relationships if I removed the relationships from the API response and just transmitted the bank-id at the user, to let ember know, which bank should get requested via https://host/api/bank/$id. There was a fulFilled promise attached to each user, but no visible try in the networks-tab of the inspector, where ember was requesting the missing record data of the related bank.