We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 725e14d commit 9bd3d78Copy full SHA for 9bd3d78
lib/gon/helpers.rb
@@ -13,6 +13,8 @@ def include_gon(options = {})
13
elsif Gon.global.all_variables.present?
14
Gon.clear
15
Gon::Base.render_data(options)
16
+ elsif options[:init].present?
17
+ Gon::Base.render_data(options)
18
else
19
""
20
end
spec/gon/basic_spec.rb
@@ -79,6 +79,12 @@
79
'gon.int=1;'
80
81
82
+
83
+ it 'outputs correct js without variables, without tag and gon init' do
84
+ @base.include_gon(need_tag: false, init: true).should == \
85
+ 'window.gon = {};'
86
+ end
87
88
89
90
it 'returns exception if try to set public method as variable' do
0 commit comments