Rails catch-all/globbing routes

ruby, ruby-on-rails, ruby-on-rails-3

Solution

put

match '*path' => 'your_controller#your_action'

at the end of the routes.rb file. This is important, since the routes are stepped through top down.

See also http://guides.rubyonrails.org/routing.html -> 3.10

Problem

I am using rails 3.0.14, and I am constructing routes.rb using the resourceful style. I'd like to have a wildcard route that catches all requests that do not match to any route stated. What's the appropriate way to construct such a route?

Original source