lib/redis/objects/values.rb in redis-objects-0.4.0 vs lib/redis/objects/values.rb in redis-objects-0.4.1

- old
+ new

@@ -13,14 +13,15 @@ module ClassMethods # Define a new simple value. It will function like a regular instance # method, so it can be used alongside ActiveRecord, DataMapper, etc. def value(name, options={}) @redis_objects[name.to_sym] = options.merge(:type => :value) + klass_name = '::' + self.name if options[:global] instance_eval <<-EndMethods def #{name} - @#{name} ||= Redis::Value.new(field_key(:#{name}), redis, @redis_objects[:#{name}]) + @#{name} ||= Redis::Value.new(redis_field_key(:#{name}), #{klass_name}.redis, #{klass_name}.redis_objects[:#{name}]) end def #{name}=(value) #{name}.value = value end EndMethods @@ -33,10 +34,10 @@ end EndMethods else class_eval <<-EndMethods def #{name} - @#{name} ||= Redis::Value.new(field_key(:#{name}), redis, self.class.redis_objects[:#{name}]) + @#{name} ||= Redis::Value.new(redis_field_key(:#{name}), #{klass_name}.redis, #{klass_name}.redis_objects[:#{name}]) end def #{name}=(value) #{name}.value = value end EndMethods \ No newline at end of file