Active resource error expecting hash

Hello, I want to call a REST API with active resource, described here:

this is my code: require ‘active_resource’ class Issue < ActiveResource::Base ActiveResource::Base.include_root_in_json = true self.site = ‘http://demo.redmine.org/’ end

Retrieving issues

issue = Issue.find(:all) and getting this error: /activeresource-4.0.0/lib/active_resource/base.rb:1327:in load': expected an attributes Hash, got ["issues", [{"id"=>91663, "project"=>{"id"=>77006, "name"=>"proj1"},.... The link mentions: *You may need to set include_root_in_json = true` in your ActiveResource class*

But I don’t understand where and how. Greatly appreciate your help.

Cheers, Peter

Your `find` is expecting a singular element name back: 'issue' rather than 'issues'.

Take a look at this: http://www.rubydoc.info/gems/activeresource/4.0.0/ActiveResource/Collection

And do something like this:

** issue.rb ** require 'active_resource'

class Issue < ActiveResource::Base   self.site = 'http://demo.redmine.org/’   self.collection_parser = IssueCollection end

** issue_collection.rb ** class IssueCollection < ActiveResource::Collection   def initialize(parsed = {})     @elements = parsed['issues']   end end

HTH,