Sha256: 520092f316d0c348bdcb04a55a6703bbf40843fbdd068be58ec39076617a341a
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 Bytes
Contents
module Gon module Helpers def self.included base base.send(:include, InstanceMethods) end module InstanceMethods def include_gon data = Gon.all_variables script = "<script>window.gon = {};" data.each do |key, val| script += "gon." + key.to_s + '=' + val.to_json + ";" end script += "</script>" script.html_safe end end end module GonHelpers def self.included base base.send(:include, InstanceMethods) end module InstanceMethods def gon if !Gon.request_env || Gon.request_env.object_id != request.env.object_id Gon.request_env = request.env end Gon end end end end ActionView::Base.send :include, Gon::Helpers ActionController::Base.send :include, Gon::GonHelpers
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gon-1.1.0 | lib/gon/helpers.rb |