whoahbot/dm-redis-adapter — Issue #21: Model.all.destroy fails to `aggregate` (DM 1.2.0)
Author: ujifgc
Created: 2011-11-12 16:00:27+00:00
State: open

To fix the issue I ended up with this monkey patch:

```diff
module DataMapper
module Adapters
class RedisAdapter
def delete(collection)
- collection.count.times do |x|
- record = collection[x]
+ collection.each do |record|
@redis.del("#{collection.query.model.to_s.downcase}:#{record[redis_key_for(collection.query.model)]}")
@redis.srem(key_set_for(collection.query.model), record[redis_key_for(collection.query.model)])
record.model.properties.select {|p| p.index}.each do |p|
@redis.srem("#{collection.query.model.to_s.downcase}:#{p.name}:#{encode(record[p.name])}", record[redis_key_for(collection.query.model)])
end
end
end
end
end
end
```