Skip to content

Commit

Permalink
maybe this ?
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoodrow authored Nov 12, 2023
1 parent aa9035b commit b402f01
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/patches/active_record/rails7_1/serialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ def serialize(attr_name, class_name_or_coder = Object, **options)
if class_name_or_coder == ::JSON || [:load, :dump].all? { |x| class_name_or_coder.respond_to?(x) }
options = options.merge(coder: class_name_or_coder, type: Object)
else
options = options.merge(code: default_column_serializer, type: class_name_or_coder)
options = options.merge(code: default_column_serializer || ::YAML, type: class_name_or_coder)
end

super(attr_name, **options)

coder = if options[:coder] == ::YAML || options[:coder] == ::ActiveRecord::Coders::YAMLColumn
options[:coder]
else
build_column_serializer(attr_name, options[:coder], options[:type], options[:yaml])
end
coder = build_column_serializer(attr_name, options[:coder], options[:type], options[:yaml])

self.globalize_serialized_attributes = globalize_serialized_attributes.dup
self.globalize_serialized_attributes[attr_name] = coder
Expand Down

0 comments on commit b402f01

Please sign in to comment.