ActiveRecord introduced a change to its default JSON output format. It went from
{ "user": { some_junk } }
to
{ some_junk }
ActiveResource has apparently followed their lead, expecting to consume JSON as
{ some_junk }
I am trying desperately to consume a RESTful web service which emits
{ "user": { some_junk } }
Is there a way to tell my ActiveResource::Base class to do so? Here's my code.
class User < ActiveResource::Base
self.site = "http://example.com/"
self.format = :json
end
Update: I'm giving up on ActiveResource as broken for now, unless someone knows the answer; in the meantime, I was able to achieve the GET that I wanted via
require 'httparty' # sudo gem install httparty
result = HTTParty.get('http://foo.com/bar.json', headers => { "Foo" => "Bar"})
# result is a hash created from the JSON -- sweet!