@@ -63,9 +63,9 @@ when the resource names are included in the `include` option.
63
63
Including nested associated resources is also supported.
64
64
65
65
``` ruby
66
- render @posts , include: [' author' , ' comments' , ' comments.author' ]
66
+ render json: @posts , include: [' author' , ' comments' , ' comments.author' ]
67
67
# or
68
- render @posts , include: ' author,comments,comments.author'
68
+ render json: @posts , include: ' author,comments,comments.author'
69
69
```
70
70
71
71
In addition, two types of wildcards may be used:
@@ -76,7 +76,7 @@ In addition, two types of wildcards may be used:
76
76
These can be combined with other paths.
77
77
78
78
``` ruby
79
- render @posts , include: ' **' # or '*' for a single layer
79
+ render json: @posts , include: ' **' # or '*' for a single layer
80
80
```
81
81
82
82
The format of the ` include ` option can be either:
@@ -94,15 +94,15 @@ The following would render posts and include:
94
94
It could be combined, like above, with other paths in any combination desired.
95
95
96
96
``` ruby
97
- render @posts , include: ' author.comments.**'
97
+ render json: @posts , include: ' author.comments.**'
98
98
```
99
99
100
100
##### Security Considerations
101
101
102
102
Since the included options may come from the query params (i.e. user-controller):
103
103
104
104
``` ruby
105
- render @posts , include: params[:include ]
105
+ render json: @posts , include: params[:include ]
106
106
```
107
107
108
108
The user could pass in ` include=** ` .
0 commit comments