Skip to content

Instantly share code, notes, and snippets.

@mikemunsie
Last active July 21, 2017 14:55
Show Gist options
  • Save mikemunsie/49e787f556407ba040a256c8aab24b2c to your computer and use it in GitHub Desktop.
Save mikemunsie/49e787f556407ba040a256c8aab24b2c to your computer and use it in GitHub Desktop.
Creating a Custom Store in Ember
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
namespace: 'api/v1/admin'
});
import Ember from 'ember';
import Config from 'share/config/environment';
const {
get,
inject,
} = Ember;
export default Route.extend({
store: inject.service(),
adminStore: inject.service("stores/admin"),
init() {
// Will use the admin store with the admin adapter (api/v1/admin)
get(this, 'adminStore').findAll("user");
// Will use the regular store (api/v1)
get(this, 'store').findAll("user");
}
}
import DS from 'ember-data';
const {
attr,
Store
} = DS;
export default Store.extend({
adapterFor(modelName) {
return this._super("admin");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment