module ActiveModel::Dirty

Public Instance Methods

attribute_will_change!(attr) click to toggle source

Handle *_will_change! for method_missing.

# File lib/patch/active_model_support_test_value_patch.rb, line 12
def attribute_will_change!(attr)
  return if attribute_changed?(attr)

  begin
    value = __send__(attr)
    value = value.duplicable? ? value.clone : value
  rescue TypeError, NoMethodError,ArgumentError
  end

  set_attribute_was(attr, value)
end