File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,17 @@ def include_gon(options = {})
99 if Gon . request_env && Gon . all_variables . present?
1010 data = Gon . all_variables
1111 namespace = options [ :namespace ] || 'gon'
12- script = " <script>window." + namespace + " = {};"
13- unless options [ :camel_case ]
12+ script = ' <script>window.' + namespace + ' = {};'
13+ if options [ :camel_case ]
1414 data . each do |key , val |
15- script += namespace + "." + key . to_s + '=' + val . to_json + ";"
15+ script << namespace + '.' + key . to_s . camelize ( :lower ) + '=' + val . to_json + ';'
1616 end
1717 else
1818 data . each do |key , val |
19- script += namespace + "." + key . to_s . camelize ( :lower ) + '=' + val . to_json + ";"
19+ script << namespace + '.' + key . to_s + '=' + val . to_json + ';'
2020 end
2121 end
22- script += " </script>"
22+ script << ' </script>'
2323 script . html_safe
2424 else
2525 ""
You can’t perform that action at this time.
0 commit comments