ruby-grape / ruby-grape/grape-roar
Dynamic options to to_json
Open
Nobody has claimed this yet.
question
- Dominant language
- Ruby
- Stars
- 59
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
I often find myself writing code like:
::FullActivityRepresenter.prepare(full_activity).to_json(student: current_student)
or..
AttemptRepresenter.prepare(attempt).to_json(wrap: :attempt)
This gem looks great, but I can't seem to figure out an easy way to send data to the to_json method.
I would imagine some changes would need to happen here and here
Any ideas - if this is already possible - to how I can get this working?
Contributor guide
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 lib/grape/roar/formatter.rb and the referenced Grape formatter entry point at lib/grape/middleware/formatter.rb#L33. Determine how options should reach to_json, then verify that calls passing student or wrap data are supported and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100