lib/gon.rb in gon-5.0.1 vs lib/gon.rb in gon-5.0.2

- old
+ new

@@ -23,10 +23,13 @@ def method_missing(method, *args, &block) if method.to_s =~ /=$/ if public_method_name?(method) raise 'You can\'t use Gon public methods for storing data' end + unless current_gon + raise 'Assign request-specific gon variables only through `gon` helper, not through Gon constant' + end set_variable(method.to_s.delete('='), args[0]) else get_variable(method.to_s) end @@ -47,14 +50,14 @@ set_variable(name.to_s, value) end end def all_variables - current_gon.gon + current_gon.gon if current_gon end def clear - current_gon.clear + current_gon.clear if current_gon end def rabl(*args) data, options = Gon::Rabl.handler(args) store_builder_data 'rabl', data, options