Skip to content

Commit

Permalink
In sinatra doesn't exist helper 'to_json'
Browse files Browse the repository at this point in the history
  • Loading branch information
gazay committed Jan 10, 2012
1 parent 3ca1d53 commit 1183347
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/gon/sinatra/helpers.rb
Expand Up @@ -13,11 +13,11 @@ def include_gon(options = {})
script = "<script>window." + namespace + " = {};" script = "<script>window." + namespace + " = {};"
unless options[:camel_case] unless options[:camel_case]
data.each do |key, val| data.each do |key, val|
script += namespace + "." + key.to_s + '=' + val.to_json + ";" script += namespace + "." + key.to_s + '=' + val.to_s + ";"
end end
else else
data.each do |key, val| data.each do |key, val|
script += namespace + "." + key.to_s.camelize(:lower) + '=' + val.to_json + ";" script += namespace + "." + key.to_s.camelize(:lower) + '=' + val.to_s + ";"
end end
end end
script += "</script>" script += "</script>"
Expand Down

0 comments on commit 1183347

Please sign in to comment.