Module: ActiveModel::Type::Helpers::Mutable
Do not use. This module is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
::ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array ,
::ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Hstore ,
::ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Jsonb ,
::ActiveRecord::ConnectionAdapters::PostgreSQL::OID::LegacyPoint ,
::ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Point ,
::ActiveRecord::Encryption::EncryptedAttributeType ,
::ActiveRecord::Type::Json ,
::ActiveRecord::Type::Serialized
| |
Defined in: | activemodel/lib/active_model/type/helpers/mutable.rb |
Instance Attribute Summary
- #mutable? ⇒ Boolean readonly
Instance Method Summary
- #cast(value)
-
#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).
Instance Attribute Details
#mutable? ⇒ Boolean (readonly)
[ GitHub ]# File 'activemodel/lib/active_model/type/helpers/mutable.rb', line 18
def mutable? # :nodoc: true end
Instance Method Details
#cast(value)
[ GitHub ]# File 'activemodel/lib/active_model/type/helpers/mutable.rb', line 7
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.
# File 'activemodel/lib/active_model/type/helpers/mutable.rb', line 14
def changed_in_place?(raw_old_value, new_value) raw_old_value != serialize(new_value) end