JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Best practices for making relationships immutable?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
From the docs, it looks like we can make a resource read-only by using immutable, but, is there a similar option to restrict operations in a relationship?
Given the following
# brand has-many motorcycles
jsonapi_resources :brand
jsonapi_resources :motorcycle
I want to restrict the operations between brands/relationships/motorcycles so only GET is allowed.
I found a workaround doing the following, but I wonder if there is a better solution.
jsonapi_resources :brands do
jsonapi_relationships only: [:get]
end
jsonapi_resources :motorcycles
If that's the case I'll gladly add a note to the README so others can find it too.
Thanks!
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
Start with the README and the jsonapi_relationships only: [:get] configuration shown in the issue, comparing it with the documented immutable option. Confirm whether this configuration is the supported way to allow only GET operations for the relationship, then document the guidance and example in the README.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100