File tree Expand file tree Collapse file tree 5 files changed +8
-6
lines changed
Expand file tree Collapse file tree 5 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -349,13 +349,13 @@ Thats it!
349349Puts this line into ` Gemfile ` then run ` $ bundle ` :
350350
351351``` ruby
352- gem ' gon' , ' 3.0.3 '
352+ gem ' gon' , ' 3.0.4 '
353353```
354354
355355Or if you are old-school Rails 2 developer put this into ` config/environment.rb ` and run ` $ rake gems:install ` :
356356
357357``` ruby
358- config.gem ' gon' , :version => ' 3.0.3 '
358+ config.gem ' gon' , :version => ' 3.0.4 '
359359```
360360
361361Or manually install gon gem: ` $ gem install gon `
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ module Base
33 class << self
44
55 def render_data ( options )
6+ data = Gon . all_variables || { }
67 if Gon . global . all_variables . present?
7- Gon :: Request . gon [ ' global' ] = Gon . global . all_variables
8+ data [ : global] = Gon . global . all_variables
89 end
9- data = Gon . all_variables
1010 namespace = options [ :namespace ] || 'gon'
1111 need_tag = options [ :need_tag ] . nil? || options [ :need_tag ]
1212 start = "#{ need_tag ? '<script>' : '' } window.#{ namespace } = {};"
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def gon
2424 end
2525
2626 def clear
27- @request_env [ ' gon' ] = { }
27+ env && ( env [ : gon] = { } )
2828 end
2929
3030 end
Original file line number Diff line number Diff line change 11module Gon
2- VERSION = '3.0.3 '
2+ VERSION = '3.0.4 '
33end
Original file line number Diff line number Diff line change 44
55 before ( :each ) do
66 Gon ::Global . clear
7+ Gon ::Request . instance_variable_set ( :@request_env , nil )
78 end
89
910 describe '#all_variables' do
5253 it 'outputs correct js with an integer and integer in Gon' do
5354 Gon ::Request .
5455 instance_variable_set ( :@request_id , request . object_id )
56+ Gon ::Request . env = { }
5557 Gon . int = 1
5658 Gon . global . int = 1
5759 @base . include_gon . should == "<script>window.gon = {};" +
You can’t perform that action at this time.
0 commit comments