lib/redis_assist/base.rb
def update_columns(attrs)
      redis.multi do
        attrs.each do |attr, value|
          if self.class.fields.has_key?(attr)
            write_attribute(attr, value)  
            redis.hset(key_for(:attributes), attr, self.class.transform(:to, attr, value)) unless new_record?
          end

          if self.class.lists.has_key?(attr)
            write_list(attr, value)       

            unless new_record?
              redis.del(key_for(attr))
              redis.rpush(key_for(attr), value) unless value.empty?
            end
          end

          if self.class.hashes.has_key?(attr)
            write_hash(attr, value)       

            unless new_record?
              hash_as_args = hash_to_redis(value)
              redis.hmset(key_for(attr), *hash_as_args)
            end
          end
        end
      end
    end
def update_columns(attrs)
      redis.multi do
        attrs.each do |attr, value|
          if self.class.fields.has_key?(attr)
            write_attribute(attr, value)  
            redis.hset(key_for(:attributes), attr, self.class.transform(:to, attr, value)) unless new_record?
          end

          if self.class.lists.has_key?(attr)
            write_list(attr, value)       

            unless new_record?
              redis.del(key_for(attr))
              redis.rpush(key_for(attr), value) unless value.empty?
            end
          end

          if self.class.hashes.has_key?(attr)
            write_hash(attr, value)       

            unless new_record?
              hash_as_args = hash_to_redis(value)
              redis.hmset(key_for(attr), *hash_as_args)
            end
          end
        end
      end
    end
def update_columns ( attrs ) redis . multi do attrs . each do | attr , value | if self . class . fields . has_key? ( attr ) write_attribute ( attr , value ) redis . hset ( key_for ( :attributes ) , attr , self . class . transform ( :to , attr , value ) ) unless new_record? end if self . class . lists . has_key? ( attr ) write_list ( attr , value ) unless new_record? redis . del ( key_for ( attr ) ) redis . rpush ( key_for ( attr ) , value ) unless value . empty? end end if self . class . hashes . has_key? ( attr ) write_hash ( attr , value ) unless new_record? hash_as_args = hash_to_redis ( value ) redis . hmset ( key_for ( attr ) , hash_as_args ) end end end end end
Update fields without hitting the callbacks
Update fields without hitting the callbacks