Reputation: 12348
My Ember app has just one model, Org,
App.Org = DS.Model.extend({
name: DS.attr('string')
});
which is called inside the Route model through
App.Router.map(function(){
this.resource('organization', {path: '/'});
});
App.OrganizationRoute = Ember.Route.extend({
model: function() {
return App.Org.find();
}
});
and I am using the Local Storage Adapter.
So I expect the find()
of the LSAdapter to be called. However it seems like this is not the case as I have put in
console.log("inside find of LSAdapter");
inside my modified version of LSAdapter's find function but that line is not printed in the console.
Here is the jsbin's code, where the js contains the modified LSAdapter on top and my Ember app on the bottom.
Here is the jsbin running, please open up the console.
So please help me figure out where/how find
is called. Thanks.
Upvotes: 1
Views: 152
Reputation: 6153
The interesting thing is that the find
method is delegated via DS.Store
, so if you don't pass an id
or a query object, it redirects to findAll
on your adapter. That is why your console.log
was not printing anything.
You can have a look at the delegation here: emberjs/[email protected]#428.
Bonus: If you have a route, and it has no children, it should not be a resource
, unless you are using the implied index
sub-route.
App.Router.map(function(){
this.route('organization', {path: '/'});
});
Upvotes: 2