This project is archived and is in readonly mode.
JSON encoding breaks when JSON gem is loaded before Active Support
-
findchris
Seems like a fix/hack is to create an initializer containing just this: require 'json/add/rails'
See here for background: http://support.fiveruns.com/disc...
-
Dylan Markow
Having a similar problem. Using Beta 3, with no other gems installed (including json_pure). Calling a simple .to_json on an array of ActiveRecord objects works fine, but as soon as I add any parameters (for example, .to_json(:only => ...)) I get the same "wrong argument type Hash (expected Data)" error. Exact same code worked perfectly in Rails 2.3.5
-
Neeraj Singh
I am unable to find where in rails source code base a dependency on json_pure is defined. I know gemcutter has a dependency on json_pure.
-
Neeraj Singh
Ok. Without json_pure rails edge is working fine for me.
Only when I incllude json_pure in Gemfile my test blows up.
-
Sebastian
I have the same problem with Rails 3 beta 4 & the json_pure gem.
The problem arises because cucumber depends on json_pure. Any suggestions?
-
Aslak Hellesøy
I could remove the json_pure dependency from Cucumber (it is only needed when you use the wire-protocol, which most Rails people don't). However, this seems like the wrong solution.
active_support and json_pure need to figure out a way to coexist.
-
David Trasbo
- Importance changed from to
Works fine on Rails 3.0.0 RC.
ruby-1.8.7-p299 > require 'rubygems' => true ruby-1.8.7-p299 > require 'json' => true ruby-1.8.7-p299 > require 'active_support' => true ruby-1.8.7-p299 > p({'a' => 34.0}.to_json) "{\"a\":34.0}" => nil -
Ryan Bigg
Automatic cleanup of spam.
-
Ryan Bigg
Automatic cleanup of spam.
-
Aslak Hellesøy
FWIW, Cucumber/Gherkin gems no longer depend on json_pure, but json instead.
-
rails
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails
- State changed from open to stale