Skip to content

Commit

Permalink
Set param to ecf_id for new API routes (#1322)
Browse files Browse the repository at this point in the history
There's a source of potential confusion where we're dealing with ecf_id
and referring to it as id. I think it's clearer if we override param so
it's clear exactly what we're referring to.
  • Loading branch information
peteryates authored Apr 24, 2024
1 parent 6721ffb commit ec277c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v3/statements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def index
end

def show
render json: to_json(statements_query.statement(ecf_id: statement_params[:id]))
render json: to_json(statements_query.statement(ecf_id: statement_params[:ecf_id]))
end

private
Expand All @@ -25,7 +25,7 @@ def statements_query
end

def statement_params
params.permit(:id, filter: %i[cohort updated_since])
params.permit(:ecf_id, filter: %i[cohort updated_since])
end

def cohort_start_years
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
put :void, path: "void"
end

resources :statements, only: %i[index show]
resources :statements, only: %i[index show], param: :ecf_id
end
end

Expand Down

0 comments on commit ec277c1

Please sign in to comment.