Skip to content

Ensure slurp keys are symbolized #20

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2015

Conversation

jamesdphillips
Copy link
Contributor

If the parameter's key is not a symbol the path cannot be built.

Ex.

class User < JsonApiClient::Resource
  belongs_to :organization
end 

user = User.create("id" => 12, "organization_id" => 10, "name" => "Gob Bluth")
#=> Exception, "Not all prefix parameters specified"

user = User.create(params.require(:user).permit(:id, :organization_id, :name))
#=> Exception, "Not all prefix parameters specified"

The exception is thrown on line 35, in the example it equates to:
"/organizations/%{id}/users" % { "organization_id" => 12 } #=> KeyError: key{organization_id} not found

If the internal key is not a symbol the path cannot be applied
@chingor13
Copy link
Collaborator

Can you put the failing case into a test so we can ensure it won't happen again if a refactor happens?

@chingor13 chingor13 mentioned this pull request Feb 26, 2015
chingor13 added a commit that referenced this pull request Feb 26, 2015
Ensure slurp keys are symbolized
@chingor13 chingor13 merged commit 160c953 into JsonApiClient:master Feb 26, 2015
@chingor13
Copy link
Collaborator

whoops, merged this accidentally. but merged in #27 which fixes this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants