This project is archived and is in readonly mode.

#3485 ✓resolved
okkez

JSON.dump({}) raise NoMethodError

Reported by okkez | November 12th, 2009 @ 01:27 PM

This code raise NoMethodError.

  require 'rubygems'
  require 'activesupport'
  JSON.dump({}) # raise NoMethodError

but,

  require 'rubygems'
  require 'json'
  JSON.dump({}) # => "{}"

In 'active_support/json/encoders/hash.rb' Hash#as_json or Hash#to_json is wrong.
I attached a simple patch for this problem.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages