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? A Serializer might 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
Yes, you should use active-model-adapter
maintained by Ember Data organisation. All instructions how to use can be found in README.