method

serialize

rails latest stable - Class: ActiveModel::Type::SerializeCastValue
serialize(type, value)
public

No documentation available.

# File activemodel/lib/active_model/type/serialize_cast_value.rb, line 25
      def self.serialize(type, value)
        # Using `type.equal?(type.itself_if_...)` is a performant way to also
        # ensure that `type` is not just a DelegateClass instance (e.g.
        # ActiveRecord::Type::Serialized) unintentionally delegating
        # SerializeCastValue methods.
        if type.equal?((type.itself_if_serialize_cast_value_compatible rescue nil))
          type.serialize_cast_value(value)
        else
          type.serialize(value)
        end
      end