Active model adapter sending request in camelCase instead of snake_case


#1

this.store.find('featured_topic') sends a request /featuredTopics instead of /featured_topics. I use Ember Data : 1.0.0-beta.6+pre.361a00e7, also checked with the latest build, the same behavior happens. Is it how it should be ? Should I define this separately?


#2

Could you please share how are you setting up your adapter?


#3
    //store.js
    App.Store = DS.Store.extend({
      adapter: 'DS.ActiveModelAdapter'
    });

And the model, this sends req to /featuredTopics with the query this.store.find('featured_topic')

App.FeaturedTopic = DS.Model.extend({

  topic: DS.belongsTo('topic')

});

#4

I think your issue is that you have your adapter defined as a string. I don’t use ember-data, but this is how the documentation refers to setting an adapter on the store.

(Go to the actual link since discourse doesn’t respect anchors in the preview). https://github.com/emberjs/data/blob/master/TRANSITION.md#adapters


#5

You are absolutely right, that worked, thanks :smiley: I was using the code generated by ember-rails which apparently still uses the old version of ember-data. But I installed the latest version of ember-data, checked the transition guide for every other syntax except for configuring adapter . Ah! very dumb! :smiley: