Sha256: 270904fbbd6c912c8d4a0eb28a6705fe7fa99c81c78d7e6932f0eeb5d3b08f5e
Contents?: true
Size: 720 Bytes
Versions: 4
Compression:
Stored size: 720 Bytes
Contents
module ActiveRecord module Type module Internal # :nodoc: class AbstractJson < ActiveModel::Type::Value # :nodoc: include ActiveModel::Type::Helpers::Mutable def type :json end def deserialize(value) if value.is_a?(::String) ::ActiveSupport::JSON.decode(value) rescue nil else value end end def serialize(value) if value.is_a?(::Array) || value.is_a?(::Hash) ::ActiveSupport::JSON.encode(value) else value end end def accessor ActiveRecord::Store::StringKeyedHashAccessor end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems