Module: ActiveRecord::AttributeMethods::Dirty

Defined in:
lib/composite_primary_keys/attribute_methods/dirty.rb

Instance Method Summary collapse

Instance Method Details

#write_attribute(attr, value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/composite_primary_keys/attribute_methods/dirty.rb', line 4

def write_attribute(attr, value)
  # CPK
  if attr.kind_of?(Array)
    # A *composite* attribute can't be marked as changed! So do nothing now.
    # We will come back in here with an *individual* attribute when Write#write_attribute looks through the individual attributes comprising this composite key:
    # [attr_name, value].transpose.map {|name,val| write_attribute(name, val)}
  else
    attr = attr.to_s

    save_changed_attribute(attr, value)
  end

  # Carry on.
  super(attr, value)
end