Skip to content

Commit f63eb75

Browse files
committed
Merge pull request gazay#3 from edtsech/master
Support for different types
2 parents baa9722 + 83cd75e commit f63eb75

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/gon/helpers.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ def include_gon
1010

1111
script = "<script>function Gon(){"
1212
data.each do |key, val|
13-
script += "this." + key.to_s + "'" + val.to_s + "';"
14-
end
13+
val = "'#{val}'" if val.instance_of? String
14+
script += "this." + key.to_s + val.to_json + ";"
15+
end
1516
script += "}; var Gon = new Gon()</script>"
1617
script.html_safe
1718
end

0 commit comments

Comments
 (0)