0
votes

I'm using the newest emberjs and I've got the App.Card model with the following: contactTypes: DS.hasMany('App.ContactType') And ContactType with: card: DS.belongsTo('App.Card') And the store looks like that:

App.Adapter = DS.RESTAdapter.extend()

App.Adapter.map 'App.Card', contact_types: embedded: "always"ยง

When I get the card http response looks fine: {"card":{"id":9,"first_name":"fsa","last_name":"fsa","contact_types":[{"id":9,"number":"fsdfs","name":"fdsfsd", "card_id": 9},... ]

When I want to get embedded collection I got empty array: card.get('contactTypes').content => []

How can I load the embedded models that I received from the server?

1

1 Answers

0
votes

Your http response is not the format which ember-data expects for sideloaded data.

Look at http://emberjs.com/guides/models/the-rest-adapter/#toc_sideloaded-relationships how your response should look like.

Maybe there is a way to configure/adapt the RESTAdapter...