Method: ActiveModel::AttributeMutationTracker#changed?

Defined in:
activemodel/lib/active_model/attribute_mutation_tracker.rb

#changed?(attr_name, from: OPTION_NOT_GIVEN, to: OPTION_NOT_GIVEN) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
47
48
# File 'activemodel/lib/active_model/attribute_mutation_tracker.rb', line 44

def changed?(attr_name, from: OPTION_NOT_GIVEN, to: OPTION_NOT_GIVEN)
  attribute_changed?(attr_name) &&
    (OPTION_NOT_GIVEN == from || original_value(attr_name) == type_cast(attr_name, from)) &&
    (OPTION_NOT_GIVEN == to || fetch_value(attr_name) == type_cast(attr_name, to))
end