Module: ActiveModel::Type::Helpers::Mutable

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object


5
6
7
# File 'activemodel/lib/active_model/type/helpers/mutable.rb', line 5

def cast(value)
  deserialize(serialize(value))
end

#changed_in_place?(raw_old_value, new_value) ⇒ Boolean

raw_old_value will be the `_before_type_cast` version of the value (likely a string). new_value will be the current, type cast value.

Returns:


12
13
14
# File 'activemodel/lib/active_model/type/helpers/mutable.rb', line 12

def changed_in_place?(raw_old_value, new_value)
  raw_old_value != serialize(new_value)
end