Still curious what the best approach is to act on return data. I'm having a little trouble with how Deferred methods act on what is returned from a model's findAll.
For instance:
- var SomeModel = can.Model.extend({
- findAll: 'GET some/path/to/data.json'
- });
- var mod = SomeModel.findAll().then(function(data) {
- console.log( data ); // Nothing ...
- });
- console.log( mod ); // logs the Deferred obj
In this case the data is a local static json file and I get nothing passed into the $.then callback. On second look, having the findAll path be an actual api endpoint does return data, an array. Not sure why local json file wouldn't respond same way.
Update: findAll() is picky about data structure? If it's a single object data won't be passed? Changed the above to findOne() for the data which is a single object and it works.