{}.to_json()
=> "{}"
{}.to_json({})
TypeError: wrong argument type Hash (expected Data) from (irb):4:in `to_json' from (irb):4
This is in Ruby 1.8.6, Rails 2.1.1...but for some reason reloading the source fixes it:
load '/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/json/encoders/hash.rb'
=>
{}.to_json({})
=> "{}"
I'm baffled...what's a "Data" and why should to_json be expecting one?