Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add params to Ember Data's RESTAdapter AJAX requests.
App.accountId = 'asdf';
App.RESTAdapter = DS.RESTAdapter.extend({
// Scope all ajax calls.
ajax: function(url, type, hash) {
if (Ember.isEmpty(hash)) hash = {};
if (Ember.isEmpty(hash.data)) hash.data = {};
hash.data.account_id = App.accountId;
this._super(url, type, hash);
}
});
App.Store = DS.Store.extend({
revision: 12,
adapter: "App.RESTAdapter"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.