lib/redis/objects/hashes.rb in redis-objects-1.3.0 vs lib/redis/objects/hashes.rb in redis-objects-1.3.1

- old
+ new

@@ -13,14 +13,15 @@ module ClassMethods # Define a new hash key. It will function like a regular instance # method, so it can be used alongside ActiveRecord, DataMapper, etc. def hash_key(name, options={}) redis_objects[name.to_sym] = options.merge(:type => :dict) + ivar_name = :"@#{name}" mod = Module.new do define_method(name) do - instance_variable_get("@#{name}") or - instance_variable_set("@#{name}", + instance_variable_get(ivar_name) or + instance_variable_set(ivar_name, Redis::HashKey.new( redis_field_key(name), redis_field_redis(name), redis_options(name) ) ) end