Reputation: 174
I want to create a routes where any value is accepted, I have created one like this
get '/coworking-in-:coworking_place', to: 'home#coworking', constraints: { :coworking_place => /[a-z]*[A-Z]*/ }
It is working fine with following cases:
But it is not working in the following cases:
I want to create route that can accept any parameters in :coworking_place
Upvotes: 0
Views: 774
Reputation: 13014
Your regular expression /[a-z]*[A-Z]*/
doesn't capture all the groups. See - http://rubular.com/r/laRElzp1QU
You probably need /[a-zA-Z0-9-]+/
. This whitelists all upper-case, lowercase characters, numbers, and -
. Check result - http://rubular.com/r/niCKQDQIjl
Upvotes: 1