Permalink
Browse files

fixed limit

  • Loading branch information...
1 parent ebc0c3e commit 6fef56c07e6b5a75042afa773a7e0428180141ea @joeferner committed Aug 2, 2012
Showing with 12 additions and 6 deletions.
  1. +6 −0 lib/model.js
  2. +6 −6 test/select.js
View
@@ -429,6 +429,12 @@ exports.define = function (name, columnDefs) {
};
Model.orderBy = persistUtil.bind('orderBy', Model.orderBy, Model);
+ Model.limit = function () {
+ var query = this.using(null);
+ return query.limit.apply(query, arguments);
+ };
+ Model.limit = persistUtil.bind('limit', Model.limit, Model);
+
Model.where = function () {
var query = this.using(null);
return query.where.apply(query, arguments);
View
@@ -291,20 +291,20 @@ exports['Select'] = nodeunit.testCase({
});
},
- "whereIn count": function(test) {
- this.Person.using(this.connection).include("phones").whereIn("phones.number", ["111-2222", "222-3333"]).count(function(err, count){
+ "whereIn count": function (test) {
+ this.Person.using(this.connection).include("phones").whereIn("phones.number", ["111-2222", "222-3333"]).count(function (err, count) {
test.ifError(err);
test.equals(count, 2);
test.done();
});
},
- "whereIn names": function(test) {
- this.Person.using(this.connection).include("phones").whereIn("phones.number", ["111-2222", "222-3333"]).all(function(err, people){
+ "whereIn names": function (test) {
+ this.Person.using(this.connection).include("phones").whereIn("phones.number", ["111-2222", "222-3333"]).all(function (err, people) {
test.ifError(err);
test.equals(people.length, 1);
- test.equals(people[0].name, "Bob O'Neill" );
+ test.equals(people[0].name, "Bob O'Neill");
test.done();
});
@@ -374,7 +374,7 @@ exports['Select'] = nodeunit.testCase({
},
"limit": function (test) {
- this.Phone.using(this.connection).orderBy("number").limit(1, 1).all(function (err, phones) {
+ this.Phone.limit(1, 1).orderBy("number").all(this.connection, function (err, phones) {
if (err) {
console.log(err);
return;

0 comments on commit 6fef56c

Please sign in to comment.