File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
lib/active_model/serializer Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ def include_args_to_hash(included)
52
52
hash [ key ] = include_args_to_hash ( value )
53
53
end
54
54
when Array
55
- included . reduce ( { } ) { |a , e | a . merge !( include_args_to_hash ( e ) ) }
55
+ included . reduce ( { } ) { |a , e | a . deep_merge !( include_args_to_hash ( e ) ) }
56
56
when String
57
57
include_string_to_hash ( included )
58
58
else
Original file line number Diff line number Diff line change @@ -44,6 +44,19 @@ def test_include_args_to_hash_from_array_of_hashes
44
44
45
45
assert_equal ( expected , actual )
46
46
end
47
+
48
+ def test_array_of_string
49
+ expected = {
50
+ comments : { author : { } , attachment : { } }
51
+ }
52
+ input = [
53
+ 'comments.author' ,
54
+ 'comments.attachment'
55
+ ]
56
+ actual = Parsing . include_args_to_hash ( input )
57
+
58
+ assert_equal ( expected , actual )
59
+ end
47
60
end
48
61
end
49
62
end
You can’t perform that action at this time.
0 commit comments