JSON-Api with Ember Data 1.13.x/Rails Active Model Serializers 0.10.x


DEPRECATED: see comment below

Just updated an ember-cli/rails pair of example apps to use json-api and thought i’d write some notes to help out anyone doing same.

The Example Apps:


The important thing here was updating to a version of active-model-serializer which uses json-api 1.0. I used 0.10.rc2.

You will need to set AMS to use json-api in an initializer.

ActiveModel::Serializer.config.adapter = :json_api

If you’re upgrading from 0.8 or 0.9 you will have to make other changes. There are a few here, though a more complex object model will probably need more:


On the Ember side:

  1. Upgrade ember/ember-data to 1.13.x

  2. Have your serializer to extend JSONAPISerializer and set isNewSerializerAPI to true. See here.

This flag is going away at some point, but if you forget it now, your serializer won’t be able to parse data in json api format, so while you’ll see the data coming over, it won’t get pushed into the store.

  1. Have your serializer to extend JSONAPIAdapter and convert from dashes on Ember side to underscores on the Rails side. See pathForType method here

So not too complex, but hopefully save you from staring at your Rails routes file before you realize you need underscores not dashes, etc. :slight_smile:


Have reallzed the above is woefully inadequate as doesn’t cover uploading data in proper json-api format. So am redoing things using the jsonapi-resources gem on the Rails side. See the crambear projects listed above for example usage.