module AWS::Record::DirtyTracking

def attribute_will_change! attribute_name

def attribute_will_change! attribute_name
  self.class.attribute_for(attribute_name) do |attribute|
    name = attribute.name
    unless orig_values.has_key?(name)
      was = __send__(name)
      begin
        # booleans, nil, etc all #respond_to?(:clone), but they raise
        # a TypeError when you attempt to dup them.
        orig_values[name] = was.clone
      rescue TypeError
        orig_values[name] = was
      end
    end
  end
  nil
end