Sha256: e9883870951940ac8d6ac43f56e33cfbf979babf6b0ba54b8ff9a234ade6a76c
Contents?: true
Size: 877 Bytes
Versions: 2
Compression:
Stored size: 877 Bytes
Contents
module ActiveRecord module AttributeMethods module Dirty 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: value = [nil] * attr.length if value.nil? [attr, value].transpose.map {|name,val| write_attribute(name, val)} else attr = attr.to_s old_value = old_attribute_value(attr) result = super store_original_raw_attribute(attr) save_changed_attribute(attr, old_value) result end end end end end ActiveRecord::Base.class_eval do alias :[]= :write_attribute public :[]= end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
composite_primary_keys-8.1.0 | lib/composite_primary_keys/attribute_methods/dirty.rb |
composite_primary_keys-8.0.0 | lib/composite_primary_keys/attribute_methods/dirty.rb |