File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ module Config
13
13
# to get added an additional root node
14
14
# with the name of the model.
15
15
ADD_ROOT_NODE_FOR = [ :json ]
16
+
17
+ ALLOW_JSONP_CALLBACK = false
16
18
17
19
# The default name of a root node of a response
18
20
# if no root paramter is passed in render_for_api
@@ -24,11 +26,14 @@ module Config
24
26
mattr_accessor :dasherize_for
25
27
mattr_accessor :add_root_node_for
26
28
mattr_accessor :default_root
29
+ mattr_accessor :allow_jsonp_callback
27
30
28
31
@@accepted_api_formats = ACCEPTED_API_FORMATS
29
32
@@dasherize_for = DASHERIZE_FOR
30
33
@@add_root_node_for = ADD_ROOT_NODE_FOR
31
34
@@default_root = DEFAULT_ROOT
35
+ @@allow_jsonp_callback = ALLOW_JSONP_CALLBACK
36
+
32
37
33
38
end
34
39
Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ def render_for_api(api_template, render_options)
67
67
68
68
# create the Hash as response
69
69
output_params [ api_format ] = api_response
70
+
71
+ output_params [ :callback ] = params [ :callback ] if ActsAsApi ::Config . allow_jsonp_callback && params [ :callback ]
70
72
71
73
render output_params
72
74
You can’t perform that action at this time.
0 commit comments