Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Override findAll fails

$
0
0
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:
  1. // App.Models.User
  2. findAll: function( filter, success, error ){
                return $.ajax({ ... });
  3. }
  4. ...
  5. App.Models.User.findAll({}, function(){}, function(){}); -> SUCCEEDS
  6. var finder = App.Models.User.findAll;  // Assign to variable
  7. finder({}, function(){}, function(){});  -> FAILS but should not!

Now, if I just rename findAll method to findAllFunky, it succeeds:

  1. var finder = App.Models.User.findAllFunky;
  2. finder(...);  -> SUCCEEDS

What's going on here? Do these methods get "special treatment"? Btw, this works perfectly in jquery MX's Model.


Viewing all articles
Browse latest Browse all 3491

Trending Articles