ruby-grape / ruby-grape/grape

Add route params in declared params

Open
#733 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug?
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

In my app i use rails like helper method permitted_params

def permitted_params
  @permitted_params ||= declared(params, include_missing: false)
end

But when i try to get route param id, declared param id had not been given and i forced to use params method

task = Task.find_by(id: params[:id])

I wrote the test, which checks declared params for route params
https://github.com/artem-russkikh/grape/blob/add-route-param-to-declared/spec/grape/route_param_to_declared_spec.rb

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the issue's linked spec, spec/grape/route_param_to_declared_spec.rb, and run that focused test. Trace how declared(params, include_missing: false) handles request values, then make route parameter IDs available through declared params and ensure the spec passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.