Request.env.to_hash.to_json breaking


I’ve been on this for a bit now trying to find out why this breaks but
I can’t. Hopefully someone else will have some idea.

I’ve been compiling a hash of which one of the objects is request.env.
I then call #to_json on the hash but it fails with:

“You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.pop”

Calling #to_json on request.env.to_hash also fails with error “stack
level too deep”.

From the backtrace you can see a loop of the following happening:

json/encoding.rb:69:in encode' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/ json/encoding.rb:19:insend
json/encoding.rb:19:in encode' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/ json/encoders/hash.rb:38:into_json’
renderable.rb:77:in `map’

Anyone have any thoughts on this?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs