Skip to content

Instantly share code, notes, and snippets.

@greatseth
Created December 30, 2008 19:49
Show Gist options
  • Select an option

  • Save greatseth/41741 to your computer and use it in GitHub Desktop.

Select an option

Save greatseth/41741 to your computer and use it in GitHub Desktop.
>> j.to_json
=> "{\"current_status\": \"completed\", \"downloading_progress\": 100, \"complete?\": true, \"id\": 74, \"downloading_status\": \"Download complete\", \"encoding_progress\": 100, \"encoding_status\": \"complete\", \"delivering_progress\": 100, \"current_progress\": null, \"delivering_status\": \"Delivery complete\"}"
>> { :jobs => [j] }.to_json
TypeError: wrong argument type Hash (expected Data)
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb:21:in `to_json'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb:21:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb:21:in `encode'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb:31:in `raise_on_circular_reference'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb:20:in `encode'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb:42:in `to_json'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb:41:in `map'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb:41:in `to_json'
from /Users/seth/diversion/hdcloud/vendor/gems/aws-s3-0.4.0/lib/aws/s3/extensions.rb:133:in `returning'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb:40:in `to_json'
from (irb):4
>> require "json/pure"
/usr/local/lib/ruby/gems/1.8/gems/json-1.1.2/lib/json/common.rb:60: warning: already initialized constant State
=> []
>> { :jobs => [j] }.to_json
=> "{\"jobs\":[{\"current_status\":\"completed\",\"downloading_progress\":100,\"complete?\":true,\"id\":74,\"downloading_status\":\"Download complete\",\"encoding_progress\":100,\"encoding_status\":\"complete\",\"delivering_progress\":100,\"current_progress\":null,\"delivering_status\":\"Delivery complete\"}]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment