When calling to_json(:to_json=>false), I was expecting a hash with primitive types. However, properties and methods are pushed into the hash as is, w/o to_json serialization. To get the true json hash, I'd have to serialize to json and deserialize the data back:
reloaded_json = JSON.load(JSON.dump( json_representation ))
Here's a spec that captures this behavior: https://gist.github.com/777189 .
Created by Alexander Sorokin - 2011-01-13 00:52:08 UTC
Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1474
When calling to_json(:to_json=>false), I was expecting a hash with primitive types. However, properties and methods are pushed into the hash as is, w/o to_json serialization. To get the true json hash, I'd have to serialize to json and deserialize the data back:
reloaded_json = JSON.load(JSON.dump( json_representation ))
Here's a spec that captures this behavior: https://gist.github.com/777189 .
Created by Alexander Sorokin - 2011-01-13 00:52:08 UTC
Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1474