Rafael Fragoso
Rafael Fragoso

Reputation: 1309

Ember Data 1.0.0 Beta 5 RESTAdapter Model Pluralization

I have the following configuration:

window.App = Ember.Application.create();

DS.RESTAdapter.reopen({
    host: 'https://localhost:3000/api/v1',
});

App.Store = DS.Store.extend({
    revision: 11,
    adapter: DS.RESTAdapter
});

But the URL that I'm trying to call is http://localhost:3000/api/v1/balance but Ember is calling "balances" at the end. Is there a way to specify the pluralization for this? Thanks!

Upvotes: 2

Views: 116

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

This is old, and should be removed, https://github.com/emberjs/data/blob/master/TRANSITION.md

App.Store = DS.Store.extend({
    revision: 11,
    adapter: DS.RESTAdapter
});

You define adapter's like so

For an application level adapter

App.ApplicationAdapter = DS.RESTAdapter;

For a specific model adapter

App.BalanceAdapter = DS.RESTAdapter.extend({
  pathForType: function(type) {
    var decamelized = Ember.String.decamelize(type); 
    //return Ember.String.pluralize(decamelized);
    return decamelized;
  }
});

Upvotes: 3

Related Questions