Permalink
Browse files

Merge pull request #130 from mikkolehtinen/master

Fix for redis adapter when finding records filtered with multiple attributes
  • Loading branch information...
1602 committed Oct 9, 2012
2 parents 01b9307 + 075699e commit 605f45dd35580c0f5c115edfdde6a6e69f8727f9
Showing with 12 additions and 1 deletion.
  1. +2 −1 lib/adapters/redis2.js
  2. +10 −0 test/common_test.js
View
@@ -60,7 +60,7 @@ var commands = Object.keys(redis.Multi.prototype).filter(function (n) {
commands.forEach(function (cmd) {
Client.prototype[cmd] = function (args, callback) {
-
+
var c = this._client, log;
if (typeof args === 'string') {
@@ -389,6 +389,7 @@ BridgeToRedis.prototype.all = function all(model, filter, callback) {
if (indexes && indexes.length) {
innerSetUsed = true;
if (indexes.length > 1) {
+ indexes.unshift(dest);
trans.sinterstore(indexes);
} else {
dest = indexes[0];
View
@@ -418,6 +418,16 @@ function testOrm(schema) {
});
+
+ it('should find records filtered with multiple attributes', function (test) {
+ Post.create({title: 'title', content: 'content', published: true, date: 1}, function (err, post) {
+ Post.all({where: {title: 'title', date: 1}}, function (err, res) {
+ test.ok(res.length > 0, 'Exact match with string returns dataset');
+ test.done();
+ });
+ });
+ });
+
it('should handle hasMany relationship', function (test) {
User.create(function (err, u) {
if (err) return console.log(err);

0 comments on commit 605f45d

Please sign in to comment.