I encountered strange behavior when overriding can.model's findAll. I need to assign findAll to a variable because it gets called generically. Anyway, here's the problem:
- // App.Models.User
- findAll: function( filter, success, error ){
return $.ajax({ ... }); - }
- ...
- App.Models.User.findAll({}, function(){}, function(){}); -> SUCCEEDS
- var finder = App.Models.User.findAll; // Assign to variable
- finder({}, function(){}, function(){}); -> FAILS but should not!
Now, if I just rename findAll method to findAllFunky, it succeeds:
- var finder = App.Models.User.findAllFunky;
- finder(...); -> SUCCEEDS
What's going on here? Do these methods get "special treatment"? Btw, this works perfectly in jquery MX's Model.