Catch-all Routes

Last week, I posted that David Black has released a guide to using and configuring routes in Ruby on Rails and commented that Rails routing has not been documented well enough before now. It seems someone else feels the same way.

Railscasts

Today, Ryan Bates has posted a screencast at Railscasts illustrating how to create a “catch-all route”. It’s not just a way to catching routes that don’t match your configured routes, it is a powerful technique for adding complex and dynamic routes. It’s ideal once you understand the basics of Rails routing and you feel ready to graduate to more advanced techniques. I use something like this to redirect legacy URLs and requests from spiders trolling for security holes.

Bookmark and Share

Leave a Reply