1
2
3
4
5
6
7
8
9
10
11
12
13
14
r.match("/admin") do |a|
  a.match("/spoons").resources.to(:controller => "spoons")
  a.match("/:spoon_id") do |b|
    b.match("/forks").resources.to(:controller => "forks")
    b.match("/:fork_id") do |c|
      c.match("/keyboards").resources.to(:controller => "keyboards")
    end
  end
  
  # More interesting now. We can get flexible with resource routes:
  # Here's one that assumes all admin routes are resources:
  # e.g. GET /admin/things/1 would be mapped to Admin::Things#show, params = {:id => 1}
  a.match_resources("/admin/:controller").to(:controller => "admin/:controller")
end