JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Including Resources
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
I have a flash card app with the following object model:
card_set
has_many :cards
has_many :tags
card
belongs_to :card_set
habtm :tags
tag
belongs_to :card_set
habits :cards
I would like to include a card’s tags whenever a card is requested, and particularly when a card_set’s cards are requested.
What is the best way to do this? Is there any way to do this declaratively in the resource file (or elsewhere)?
The docs seem to point you towards using a ResourceSerializer and serialize_to_hash in the controller but trying this seemed a bit messy.
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 by reading the resource file and the ResourceSerializer and serialize_to_hash paths mentioned in the issue. Trace how a card request and a card_set's cards are serialized, then determine how declarative inclusion should be represented. Done means requested cards include their tags without controller-specific serialization code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100