Using parentheses in routes

12 views
Skip to first unread message

Rick Martinez

unread,
Jun 25, 2013, 11:36:59 AM6/25/13
to rubyonra...@googlegroups.com
Does anyone know how to use escape parentheses in routes so I can use them in URLs? They currently denote optional params, but I can't find documentation on how to escape that.

What I want is:

Given I have a route: match "foo(:id)" => "foos#show"
When I go to "/foo(3)"
Then params[:id] should be "3"

But currently params[:id] returns "(3)"

I don't want to make :id optional.

Thanks!
Rick
Reply all
Reply to author
Forward
0 new messages