module Gon module Helpers def self.included base base.send(:include, InstanceMethods) end module InstanceMethods def include_gon data = Gon.all_variables 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