Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixing Issue 86 #96

Merged
merged 2 commits into from Nov 30, 2015

Conversation

Projects
None yet
4 participants

jramos commented Sep 5, 2013

This commit fixes issue #86 by only removing the root of the response if the result will be an Array or Hash.

@jramos jramos closed this Sep 5, 2013

@jramos jramos reopened this Sep 5, 2013

Collaborator

SweeD commented Nov 6, 2015

@rafaelfranca
Ha, it's a bit late, but I guess it would make sense to merge this one, no? 😅

@rafaelfranca rafaelfranca was assigned by SweeD Nov 6, 2015

@rafaelfranca rafaelfranca added a commit that referenced this pull request Nov 30, 2015

@rafaelfranca rafaelfranca Merge pull request #96 from jramos/issue_86
Fixing Issue 86
f3115bc

@rafaelfranca rafaelfranca merged commit f3115bc into rails:master Nov 30, 2015

1 check passed

default The Travis CI build passed
Details

@rafaelfranca rafaelfranca added a commit that referenced this pull request Nov 30, 2015

@rafaelfranca @rafaelfranca rafaelfranca + rafaelfranca Merge pull request #96 from jramos/issue_86
Fixing Issue 86
8a28d84

@rafaelfranca rafaelfranca added a commit that referenced this pull request Jan 24, 2016

@rafaelfranca rafaelfranca Revert "Merge pull request #96 from jramos/issue_86"
This reverts commit 8a28d84.
e5414b3

@rafaelfranca rafaelfranca added a commit that referenced this pull request Jan 24, 2016

@rafaelfranca rafaelfranca Revert "Merge pull request #96 from jramos/issue_86"
This reverts commit 8a28d84.
21d58dd
Contributor

mikeyhew commented Jul 25, 2016

This PR broke endpoints that respond with a hash with a single non-enumerable element. A common example is the count endpoint that many APIs have. The Shopify API responds to get /products/count with a hash, for example: {"count": 16}. Calling Formats.remove_root used to remove the root and return 6, but now it returns the whole hash.

The best fix I can think of is to add a configuration option for whether or not the root is expected in the response, and then only call Formats.remove_root when config.root_in_json_reponse is set. Any thoughts @jramos and @rafaelfranca?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment