ruby on rails - How translate serialize type with dash to model slashed structure? -


my api in rails ams (json:api) return serializer type name dash (artemis-forum-disputes), inside frontend app, uses ember, store models subdirectory structure (artemis/forum/disputes).

warning: encountered resource object type "artemis-forum-disputes", no model found model name "artemis-forum-dispute" (resolved model name using 'apollo-enterprise@serializer:application:.modelnamefrompayloadkey("artemis-forum-disputes")'). 

how solve this? thanks.

you can tell ember data model use overriding modelnamefrompayloadtype method on serializer. if override method in application serializer , have transform dashes slashes ember should able find models in subdirectory.

// app/serializers/application.js  // or app/application/serializer.js import ds 'ember-data' export default ds.jsonapiserializer.extend({   modelnamefrompayloadtype(payloadtype) {     return payloadtype.replace(/-/g, '/');   } }); 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -