Sha256: 9e2bfef63cc91ba491bc7a5dc91b80b6d9dda008c5f4c8ac2259912c3a6dce01
Contents?: true
Size: 877 Bytes
Versions: 2
Compression:
Stored size: 877 Bytes
Contents
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".freeze 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paper_trail-8.1.2 | lib/paper_trail/attribute_serializers/attribute_serializer_factory.rb |
paper_trail-8.1.1 | lib/paper_trail/attribute_serializers/attribute_serializer_factory.rb |