module PaperTrail::AttributeSerializers::AttributeSerializerFactory
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.
Constants
- AR_PG_ARRAY_CLASS
Public Class Methods
for(klass, attr)
click to toggle source
# File lib/mongo_trails/attribute_serializers/attribute_serializer_factory.rb, line 14 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