I've got an Ember CLI app using a Ruby on Rails API backend. I initially built this using a REST API, and am trying to migrate it to use JSONAPI.
To send data from Rails to Ember this is simple - I have just updated the ActiveModelSerializers gem that I was already using, and have updated the adapter and serialiser in the Ember app to be something like:
export default DS.JSONAPIAdapter;
export default DS.JSONAPISerializer;
The problem is that it is a lot of work to rewrite my whole Rails app to respond to a new data format, so I would like to stick with the REST adapter/serializer when sending data from Ember to Rails (at least in the short term). I am not sure how to do this. I was thinking of something like this:
export default DS.JSONAPISerializer.extend({
serialize(snapshot, options){
return DS.RESTSerializer.serialize(snapshot, options);
}
});
This doesn't work. Has anyone done this? Is there a good way to do it?
Many thanks
DS.RESTSerializeris a class, you would need to instantiate it with.create(). - LuxUncaught TypeError: Cannot read property 'lookup' of undefined- AdamP