Sha256: fa1c692d7c83deaaaef0b01681eec4fbb1053312cfd87cb4b52b813592e44f7d
Contents?: true
Size: 901 Bytes
Versions: 15
Compression:
Stored size: 901 Bytes
Contents
# frozen_string_literal: true require "paper_trail/type_serializers/postgres_array_serializer" module PaperTrail module AttributeSerializers # Values returned by some Active Record serializers are # not suited for writing JSON to a text column. This factory # replaces certain default Active Record serializers # with custom PaperTrail ones. module AttributeSerializerFactory AR_PG_ARRAY_CLASS = "ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array" def self.for(klass, attr) active_record_serializer = klass.type_for_attribute(attr) if active_record_serializer.class.name == AR_PG_ARRAY_CLASS TypeSerializers::PostgresArraySerializer.new( active_record_serializer.subtype, active_record_serializer.delimiter ) else active_record_serializer end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems