File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,11 @@ def serialize_argument(argument)
76
76
if argument . class == String
77
77
argument
78
78
else
79
- Serializers . serialize ( argument )
79
+ begin
80
+ Serializers . serialize ( argument )
81
+ rescue SerializationError
82
+ argument
83
+ end
80
84
end
81
85
when GlobalID ::Identification
82
86
convert_to_global_id_hash ( argument )
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ def klass
42
42
end
43
43
end
44
44
45
+ class StringWithoutSerializer < String
46
+ end
47
+
45
48
setup do
46
49
@person = Person . find ( "5" )
47
50
end
@@ -156,6 +159,14 @@ def klass
156
159
ActiveJob ::Serializers . _additional_serializers = original_serializers
157
160
end
158
161
162
+ test "serialize a String subclass object without a serializer" do
163
+ string_without_serializer = StringWithoutSerializer . new ( "foo" )
164
+ serialized = ActiveJob ::Arguments . serialize ( [ string_without_serializer ] )
165
+ deserialized = ActiveJob ::Arguments . deserialize ( JSON . load ( JSON . dump ( serialized ) ) ) . first
166
+ assert_instance_of String , deserialized
167
+ assert_equal string_without_serializer , deserialized
168
+ end
169
+
159
170
test "serialize a hash" do
160
171
symbol_key = { a : 1 }
161
172
string_key = { "a" => 1 }
You can’t perform that action at this time.
0 commit comments