问题
So I'm just starting to learn ember js. In the case of the application rest api I have namespaced models.
example: App.GlAccount = DS.Model.extend({})
the route I need it to follow is /gl/account
I thought I could fix this by creating another store like
App.GlStore = DS.Store.create({adapter:DS.RestAdapter({namespace:'gl'})}
The problem is the model uses App.Store...Anyway to tell a model to use a different store?
回答1:
Based on your example it doesn't sounds like you actually need to have multiple data stores. The following should be all you need:
App.GlAccount = DS.Model.extend({});
App.GlAccount.reopenClass({
url: 'gl/account'
});
If your needs are more complex, it is possible to have per-type adapters for your data store. See this gist for details: https://gist.github.com/4004913
来源:https://stackoverflow.com/questions/14236594/ember-data-multiple-stores