lib/ohm.rb in ohm-1.1.1 vs lib/ohm.rb in ohm-1.1.2
- old
+ new
@@ -140,11 +140,10 @@
redis.flushdb
end
# Wraps the whole pipelining functionality.
module PipelinedFetch
- private
def fetch(ids)
arr = db.pipelined do
ids.each { |id| db.hgetall(namespace[id]) }
end
@@ -810,9 +809,19 @@
if keys.size == 1
Ohm::Set.new(keys.first, key, self)
else
Ohm::MultiSet.new(key, self, Command.new(:sinterstore, *keys))
end
+ end
+
+ # Retrieve a set of models given an array of IDs.
+ #
+ # Example:
+ #
+ # User.fetch([1, 2, 3])
+ #
+ def self.fetch(ids)
+ all.fetch(ids)
end
# Index any method on your model. Once you index a method, you can
# use it in `find` statements.
def self.index(attribute)