Skip to content

ActiveResource find() not following JSON api #75

hoetmaaiers opened this Issue May 22, 2013 · 3 comments

4 participants


When following the JSON API document, I return my singular resources in an array as described:

   "designs": [
      // individual design

My app talking to the API uses ActiveResource. When I do a find in ActiveRescource


I get the following error:

ArgumentError: expected an attributes Hash, got [{"id"=>10, "title"=>" ...

ActiveResource seems to have trouble with return singular resources as an array.
Any thoughts or help on this?

radar commented May 27, 2013

Active Resource expects an attributes hash back. If you're working with an API that doesn't conform to Active Resource exactly, I would strongly recommend looking into using something different, such as HTTParty, to provide the code that talks with your API.

Fivell commented Aug 27, 2013

or you can use custom formatter

cmarkle commented Dec 28, 2013

See the comments in the collections class about using a collections parser. This worked for me in exactly the situation you described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.