def add_attributes(hash)
      hash.each_pair do |k,v|
        k = k.to_sym
        #raise DuplicateAttribute.new("#{k}") unless (k == :id or !self.respond_to?(k))
        if k == :id or !self.respond_to?(k)
          @cached_attrs[k] = v
          meta = class << self; self; end
          meta.send(:define_method, k) { @cached_attrs[k] }
          meta.send(:define_method, "#{k}=") do |new_value| 
            @cached_attrs[k] = new_value.is_a?(RedisRecord::Model) ? new_value.id : new_value
            @stored_attrs.delete(k)
          end
        end
      end
      hash
    end
def add_attributes(hash)
      hash.each_pair do |k,v|
        k = k.to_sym
        #raise DuplicateAttribute.new("#{k}") unless (k == :id or !self.respond_to?(k))
        if k == :id or !self.respond_to?(k)
          @cached_attrs[k] = v
          meta = class << self; self; end
          meta.send(:define_method, k) { @cached_attrs[k] }
          meta.send(:define_method, "#{k}=") do |new_value| 
            @cached_attrs[k] = new_value.is_a?(RedisRecord::Model) ? new_value.id : new_value
            @stored_attrs.delete(k)
          end
        end
      end
      hash
    end
Add attributes to the instance cache and define the accessor methods