jupiterjs/canjs — pull request #61 by mcaspar (2012-06-29 07:49:55+00:00)
Title: jQuery throws error when responding to findOne/findAll with an error code

jQuery throws an error when responding to findOne (findAll) with an error code like 404.

second argument to Function.prototype.apply must be an array

Tracked it down to the function pipe in model/model.js where .apply is used on _rejectWith_ to set context.

d.rejectWith.apply(this,arguments)

_arguments_ is something like

[jqXHR, "error", "Not Found"]

But _rejectWith_ takes its first argument as the new context which is the _jqXHR_ object in this case and then takes "error" as its args

Changed the function to use _rejectWith_ and _resolveWith_ without .apply