Skip to content

Commit e2f2ad2

Browse files
etiennebarriebyroot
andcommitted
Support JSON::Fragment with the old JSON encoder
Unfortunately, we can't add it to the case statement because the class might not exist if json hasn't been upgraded. Co-authored-by: Jean Boussier <[email protected]>
1 parent 612d933 commit e2f2ad2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

activesupport/lib/active_support/json/encoding.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def encode(value)
8585
# to +object.as_json+, not any of this method's recursive +#as_json+
8686
# calls.
8787
def jsonify(value)
88+
return value if value.class.name == "JSON::Fragment"
8889
case value
8990
when String, Integer, Symbol, nil, true, false
9091
value

0 commit comments

Comments
 (0)