I am having a lot of trouble understanding Grape API, specifically route_param
and how it works with just params
.
Consider this code:
desc "Return a status."
params do
requires :id, type: Integer, desc: "Status id."
end
route_param :id do
get do
Status.find(param[:id])
end
end
What route does this block produce? I get that this is a get
request, but why is it wrapped in route_param
block? Why can't it be in params
block?