This project is archived and is in readonly mode.

#5529 ✓resolved
Kent Sibilev

JSON serialization is broken

Reported by Kent Sibilev | September 2nd, 2010 @ 06:32 AM | in 3.x

JSON serialization is broken in 3.0.0 when I try to serialize a hash which includes an ActiveModel object and passing no-nil options parameter, like so:

options = {}
{:model => model_obj, :some_hash => sub_hash}.to_json(options)

The result is that sub_hash object is serialized as an empty hash and options parameter is modified to contain:

options = {:only => [], :except =[]}

The reason is that activemodel/lib/active_model/serialization.rb#serializable_hash modifies passed parameter, which it shouldn't.

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

Tags

Pages