This project is archived and is in readonly mode.

#2690 ✓resolved
Caio Chassot

#to_json not working because always being called on Object

Reported by Caio Chassot | May 21st, 2009 @ 06:24 PM | in 2.x

to_json is aliased from rails_to_json on the Object class, while in all other classes (String, Hash, etc.), only rails_to_json is defined.

The overriden rails_to_json methods do not automatically override to_json too.

In the master branch the implementation is a bit different and this is not present, but it is in 2-3-stable.

My patch just defines to_json in Object to call rails_to_json instead of aliasing it.

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

Referenced by

Pages