lib/gon/helpers.rb in gon-0.2.0 vs lib/gon/helpers.rb in gon-0.2.1
- old
+ new
@@ -8,11 +8,11 @@
def include_gon
data = Rails.cache.read('gon_variables') || {}
script = "<script>function Gon(){"
data.each do |key, val|
- script += "this." + key.to_s + "'" + val.to_s + "';"
- end
+ script += "this." + key.to_s + val.to_json + ";"
+ end
script += "}; var Gon = new Gon()</script>"
script.html_safe
end
end