Open
Description
Helpers can be accessed from before
and request blocks (e.g. get
, post
). But, params
block can not access helpers the same way.
In the following snippet, params
block throws a NoMethodError
for process_query
.
route_param :cat_id do
before do
@cat = Cat.find process_id(params[:cat_id])
end
desc "An endpoint"
params do
optional :query, type: String, coerce_with: ->(query){process_query query}
end
get :kittens do
process_id(params[:cat_id])
end
end
Is there a way to access helpers from inside the params
block?