lib/gon/helpers.rb in gon-0.3.0 vs lib/gon/helpers.rb in gon-1.0.0
- old
+ new
@@ -4,14 +4,14 @@
base.send(:include, InstanceMethods)
end
module InstanceMethods
def include_gon
- data = Rails.cache.read('gon_variables') || {}
+ data = Gon.all_variables || {}
script = "<script>window.Gon = {};"
data.each do |key, val|
- script += "Gon." + key.to_s + val.to_json + ";"
+ script += "Gon." + key.to_s + '=' + val.to_json + ";"
end
script += "</script>"
script.html_safe
end
end