lib/redis-model-extension.rb in redis-model-extension-0.3.2 vs lib/redis-model-extension.rb in redis-model-extension-0.3.3
- old
+ new
@@ -160,9 +160,10 @@
#if you know redis key and would like to get object
def get_by_redis_key(redis_key)
if redis_key.is_a?(String) && Database.redis.exists(redis_key)
unless redis_key.include?("*")
data_args = Database.redis.hgetall(redis_key)
+ klass = self.name.constantize
klass.new(data_args.merge({:old_args => data_args}))
else
raise ArgumentError, "RedisKey for method get_by_redis_key can not contains '*'"
end
else
\ No newline at end of file