I am trying to do some tricks with routes. And I need to use optional route parameter in Padrino. I googled that solution for this are "()" parenthesis. I couldn't find in docs.
But when I try to use
get :sort, :with => [:order, :asc, '(:search)'] do
them, mustermann is giving me classic error for missing parameter
cannot expand with keys [:asc, :order], possible expansions: [:asc, :order, :search]
when I try to call
url(:sbirka, :sort, :order => "id", :asc => @asc)
I also tried different style
get :sort, "/:order/:asc/(:search)" do
with the same result
Please any suggestions how to do this?
Since Padrino is based on Sinatra, every routing pattern possible with Sinatra should be possible in Padrino as well. From Sinatra's excellent README file, introductory 'Routes' section:
In your case, assuming
:searchis optional, I would try: