lib/gon.rb in gon-1.1.0 vs lib/gon.rb in gon-1.1.1
- old
+ new
@@ -1,6 +1,7 @@
require 'action_view'
+require 'action_controller'
require 'gon/helpers'
module Gon
def self.all_variables
@request_env[:gon]
@@ -21,10 +22,13 @@
end
def self.method_missing(m, *args, &block)
@request_env[:gon] ||= {}
- if ( m.to_s =~ /=/ )
+ if ( m.to_s =~ /=$/ )
+ if self.public_methods.include? m[0..-2].to_sym
+ raise "You can't use Gon public methods for storing data"
+ end
set_variable(m.to_s.delete('='), args[0])
else
get_variable(m.to_s)
end
end