Module: RedisField::ActiveRecord

Extended by:
ActiveSupport::Concern
Defined in:
lib/redis_field/active_record.rb,
lib/redis_field/active_record/class_methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#get_redis_fieldsObject



15
16
17
18
19
# File 'lib/redis_field/active_record.rb', line 15

def get_redis_fields
  redis_fields.each do |field_name|
    send "#{field_name}=", Base.new(self, field_name).get
  end
end

#redis_fieldsObject



11
12
13
# File 'lib/redis_field/active_record.rb', line 11

def redis_fields
  self.class.redis_fields
end

#sync_redis_fields!Object



21
22
23
24
25
26
27
# File 'lib/redis_field/active_record.rb', line 21

def sync_redis_fields!
  redis_fields.each do |field_name|
    if send(field_name).present?
      Base.new(self, field_name).set send(field_name)
    end
  end
end