Module: ActiveRedis::DirtyAttributes

Included in:
Base
Defined in:
lib/active_redis/dirty_attributes.rb

Instance Method Summary collapse

Instance Method Details

#check_for_changesObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/active_redis/dirty_attributes.rb', line 3

def check_for_changes
  @changed_attributes ||= {}
  self.class.attribute_definitions.each do |attribute, options|
    next unless @attributes.key?(attribute.to_sym)
    value = send(attribute)
    if value.class.name.start_with?("ActiveRedis::DirtyObjects")
      if value.dirty?
        @changed_attributes[attribute.to_s] = [value.original, value.changes]
      end
    end
  end
end