DS.BuildURLMixin#pathForType()

pathForType (modelName) String

Defined in addon/-private/adapters/build-url-mixin.js:410

Determines the pathname for a given type.

By default, it pluralizes the type's name (for example, 'post' becomes 'posts' and 'person' becomes 'people').

Pathname customization

For example if you have an object LineItem with an endpoint of "/line_items/".

app/adapters/application.js
import DS from 'ember-data';

export default DS.RESTAdapter.extend({
  pathForType: function(modelName) {
    var decamelized = Ember.String.decamelize(modelName);
    return Ember.String.pluralize(decamelized);
  }
});

Parameters:

modelName String

Returns:

String
path
doc_EmberJs
2016-11-30 16:49:29
Comments
Leave a Comment

Please login to continue.