Tuesday, December 8, 2009

[Rails] ActiveSupport 2.3.5 and json 1.2.0 gem

Hey,

I've tried every trick I can find, yet I'm still unable to get the
json gem and ActiveSupport to play nice.

No matter in which order I load json and active support, I still end
up with: NoMethodError: undefined method `[]' for
#<JSON::Ext::Generator::State:0x104b7fac0>

I'm trying to use the JSON object directly, *not* as a ActiveSupport backend:

>> JSON(:one => 1)
NoMethodError: undefined method `[]' for
#<JSON::Ext::Generator::State:0x104b7fac0>
from /Users/ian/Projects/foo/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in
`as_json'
from /Users/ian/Projects/goo/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in
`to_json'
from /opt/local/lib/ruby/gems/1.8/gems/json-1.2.0/lib/json/common.rb:183:in
`generate'
from /opt/local/lib/ruby/gems/1.8/gems/json-1.2.0/lib/json/common.rb:358:in
`JSON'
from (irb):1
>> {:one => 1}.to_json
=> "{\"one\":1}"

Any ideas?

Thanks

--

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate