Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoodrow authored Nov 12, 2023
1 parent 29d2dab commit 7536fe1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/patches/active_record/rails7_1/serialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ def serialize(attr_name, class_name_or_coder = Object, **options)
coder = if options[:coder] == ::JSON
::ActiveRecord::Coders::JSON
elsif options.key?(:coder)
options[:coder]
if coder.respond_to?(:new) && !coder.respond_to?(:load)
coder.new(attr_name, type)
else
options[:coder]
end
else
::ActiveRecord::Coders::YAMLColumn.new(attr_name, options[:type], **(options.fetch(:yaml, {})))
end
Expand Down

0 comments on commit 7536fe1

Please sign in to comment.