How can I create a catch-all route in Ruby on Rails?
I want to have all requests that satisfy a certain constraint to go to a specific controller. So I need a catch-all route. How do I specify that in Rails? Is it something like this? match '*', to: 'subdomain_controller#show', constraints: {subdomain: /.+\.users/} Will that really catch all possible routes? It's important that none slip through even if there are many nested directories. Using Ruby on Rails 3.2, but ready to upgrade to 4.0. UPDATE: '*path' seems to work. However, the issue I'm running into is whenever the file exists in my public directory, Rails renders that instead.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.