lundi 29 février 2016

Ember Data json formatting/serializing

I'm using Ember 2.3 with Ember Data but am having trouble getting data to save to my rails server. It appears that the data isn't formatted properly for what the server is expecting.

The data that works (from a scaffolding app) looks like this:

{name: "Clinic Demo", code: "CLN", position: 4}

This is what Ember Data sends:

{"data":{"attributes":{"name":"Clinic Demo","code":"CLN","position":5},"type":"clinics"}}

Should I look at serializers or change what the server expects? Serializers don't seem to be the answer. The adapter configured does hit the server, but isn't expecting this type of json data. Does the active-model-adapter correct this?

Also ember is returning this very non-descript error:

Error: The adapter rejected the commit because it was invalid




Aucun commentaire:

Enregistrer un commentaire