You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/howto/add_root_key.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
[Back to Guides](../README.md)
2
+
1
3
# How to add root key
2
4
3
5
Add the root key to your API is quite simple with ActiveModelSerializers. The **Adapter** is what determines the format of your JSON response. The default adapter is the ```Attributes``` which doesn't have the root key, so your response is something similar to:
Copy file name to clipboardExpand all lines: docs/howto/grape_integration.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
-
The AMS grape formatter relies on the existence of `env['grape.request']` which is implemeted by `Grape::Middleware::Globals`. You can meet his dependency by calling it before mounting the endpoints.
1
+
[Back to Guides](../README.md)
2
+
3
+
The ActiveModelSerializers grape formatter relies on the existence of `env['grape.request']` which is implemeted by `Grape::Middleware::Globals`. You can meet his dependency by calling it before mounting the endpoints.
2
4
3
5
In the simpliest way:
4
6
@@ -15,10 +17,10 @@ or more like what is shown in current Grape tutorials:
15
17
module MyApi
16
18
class ApiBase < Grape::API
17
19
use Grape::Middleware::Globals
18
-
20
+
19
21
require 'grape/active_model_serializers'
20
22
include Grape::ActiveModelSerializers
21
-
23
+
22
24
mount MyApi::V1::ApiBase
23
25
end
24
26
end
@@ -30,10 +32,10 @@ You could meet this dependency with your own middleware. The invocation might lo
0 commit comments