samedi 24 janvier 2015

How do I use a multi-word model name when using ember-cli?

I'm having trouble using multi-word model names in conjunction with ember-cli.


I'm getting the following warning:



WARNING: Encountered "phrase_token" in payload, but no model was found
for model name "phraseToken" (resolved model name using
DS.ActiveModelSerializer.typeForRoot("phrase_token"))


I'm doing my find as follows:



store.find('phrase-token', 123).then(function(m) { ... })


The JSON returned by my server uses the root phrase_token as I am using the ActiveModelAdapter.


One theory I have is that Ember-data is trying to use camelCase model names, but this isn't found by the ember-cli resolver that uses dasherized names.


I also tried the following:



store.find('phraseToken', 123).then(function(m) { ... })


but that fails saying there's no such model.


I haven't had much luck debugging this issue because when I attempt to put breakpoints into Chrome developer tools, they don't get triggered perhaps due to source map problems (turning off source maps doesn't help though), and I don't know how to poke around in the console because I don't know how to access my app's container (now that I don't have a global App namespace, since I'm using ember-cli). So if you have debugging tips, that would be helpful too.


Thoughts?





Aucun commentaire:

Enregistrer un commentaire