Allowing dots in Rails routes

18-Jun-2020 2306
One of the lesser known thing about how Rails matches the route segments with incoming requests.The default regular expression used for a route segment is /[^\/.?] /. It matches any combination of characters that is not a forward slash, dot or question mark.Because of this, when we hit users/john.smith/upgrade, it is matched with following regular expression by Rails.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle