Skip to content

Commit

Permalink
allow multiple arguments to where
Browse files Browse the repository at this point in the history
  • Loading branch information
joeferner committed Oct 26, 2012
1 parent 6c47baa commit 23dce93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/query.js
Expand Up @@ -42,9 +42,9 @@ var Query = function (connection, model) {
Query.prototype.where = function () { Query.prototype.where = function () {
if (typeof (arguments[0]) === 'string') { if (typeof (arguments[0]) === 'string') {
var expr = arguments[0]; var expr = arguments[0];
var params = arguments[1]; var params = Array.prototype.slice.call(arguments, 1);
if (!(params instanceof Array)) { if (params.length === 1 && params[0] instanceof Array) {
params = [ params ]; params = params[0];
} }
this._sqlTree().where.push({expr: expr, params: params}); this._sqlTree().where.push({expr: expr, params: params});
} else { } else {
Expand Down

0 comments on commit 23dce93

Please sign in to comment.