Commit 8794387
Ben Rosenblum
Correctly serializes nested hash elements when a root element is used with an Entity.
Previously, when a root element is used with an Entity, the presenter
wraps the array of Entity object in a plain hash, and the Entities end
up serialized as plain strings of the class name
(i.e., {"root":["#<EntityFoo...>","#<EntityBar...>"])
The new code recursively checks for any elements of the hash that respond
to serializable_hash and calls it if present.1 parent 346fb94 commit 8794387
File tree
2 files changed
+27
-6
lines changed- lib/grape/middleware
- spec/grape/middleware
2 files changed
+27
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
113 | 125 | | |
114 | 126 | | |
115 | 127 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 128 | + | |
| 129 | + | |
121 | 130 | | |
122 | 131 | | |
123 | | - | |
| 132 | + | |
124 | 133 | | |
125 | 134 | | |
126 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
| |||
0 commit comments