We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4f0807 commit 9c14754Copy full SHA for 9c14754
lib/gon/helpers.rb
@@ -8,11 +8,11 @@ module InstanceMethods
8
def include_gon
9
data = Rails.cache.read('gon_variables') || {}
10
11
- script = "<script>function Gon(){"
+ script = "<script>window.Gon = {};"
12
data.each do |key, val|
13
- script += "this." + key.to_s + val.to_json + ";"
+ script += "Gon." + key.to_s + val.to_json + ";"
14
end
15
- script += "}; var Gon = new Gon()</script>"
+ script += "</script>"
16
script.html_safe
17
18
0 commit comments