JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
:remove attribute leads to resource deletion
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
When I have a resource with
attributes :a, :b, :remove
every time I fetch them, jsonapi ACTUALLY REMOVES them one by one from database with following trace:
D, [2017-07-20T14:35:16.578563 #25926] DEBUG -- : SQL (0.2ms) DELETE FROM `...` WHERE `...`.`id` = 42
I, [2017-07-20T14:35:16.578784 #25926] INFO -- : #9: .../vendor/bundle/ruby/2.1.0/gems/jsonapi-resources-0.8.1/lib/jsonapi/resource.rb:216:in `_remove'
#10: .../vendor/bundle/ruby/2.1.0/gems/jsonapi-resources-0.8.1/lib/jsonapi/resource.rb:66:in `block in remove'
#14: .../vendor/bundle/ruby/2.1.0/gems/jsonapi-resources-0.8.1/lib/jsonapi/resource.rb:65:in `remove'
#15: .../vendor/bundle/ruby/2.1.0/gems/jsonapi-resources-0.8.1/lib/jsonapi/resource_serializer.rb:156:in `public_send'
#16: .../vendor/bundle/ruby/2.1.0/gems/jsonapi-resources-0.8.1/lib/jsonapi/resource_serializer.rb:156:in `block in attributes_hash'
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 resource using attributes :a, :b, :remove, then inspect lib/jsonapi/resource.rb and lib/jsonapi/resource_serializer.rb, especially _remove, remove, and attributes_hash. Done means fetching the resource no longer invokes removal or issues a database DELETE.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100