# Merb::RouteMatcher is the request routing mapper for the merb framework. # You can define placeholder parts of the url with the :symbol notation. # so r.add '/foo/:bar/baz/:id', :class => 'Bar', :method => 'foo' # will match against a request to /foo/123/baz/456. It will then # use the class Bar as your merb controller and call the foo method on it. # the foo method will recieve a hash with {:bar => '123', :id => '456'} # as the content. So the :placeholders sections of your routes become # a hash of arguments to your controller methods. This method maps # the default /controller/action and /controller/action/id urls you will # use. so leave r.add '/:controller/:action/:id' in near the bottom # of your routes. They match in the order they are defined. You can also # use a :* to glob up the rest of a pth and send it to a controller: # r.add '/bar/:*rest', :controller => 'Test', :action => 'glob' puts "Compiling routes: \n" Merb::RouteMatcher.prepare do |r| r.add '/foo/:bar/baz/:id', :controller => 'Test', :action => 'foo' r.add '/:controller/:action/:id' end m = Merb::RouteMatcher.new puts m.compiled_statement