Is there a quick and easy way to use camel case
when serializing a JsonApi model? By default is is using dasherized case
for both url and field names.
Look at EmberJS guides for an example how to make user-profile
-related adapter hit user_profile
instead:
export default DS.JSONAPIAdapter.extend({
pathForType: function(type) {
return Ember.String.underscore(type);
}
});
Requests for
person
would now target/person/1
. Requests foruser-profile
would now target/user_profile/1
If you need to serialize attributes, not just the model names, you can find related section to the topic at the very same place, direct link here.
Since the example above uses Ember.String.underscore()
, I am attaching a link to very useful String helpers Ember provides by default, Ember.String API: