JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
500 error when including relationship name in attributes hash
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Say I have a record post that has_one author... Including author in the attributes hash instead of the relationships hash causes jsonapi-resources to 500 with the following:
Internal Server Error: no implicit conversion of nil into Hash /Users/adam/.rvm/gems/ruby-2.2.3/gems/jsonapi-resources-0.7.0/lib/jsonapi/resource.rb:683:in `merge'
My guess is because this is a valid relationship name, but is not a valid attribute.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure using a resource with a has_one author relationship and author supplied in the attributes hash. Start at lib/jsonapi/resource.rb:683 and trace the merge inputs; done means this invalid placement no longer causes a 500, with the expected handling covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100