Add support for a namespace option in routing, so that you can have different resources for different contexts. So for example if you declare your routing like this:
r.match(:host => ).to(:namespace => 'admin') do |admin|
admin.resources :articles
end
#r.resources :articles, :namespace => 'admin'
# RESTful routes
r.resources :articles
That would make:
- http://foo.com/articles => Articles controller
- http://admin.foo.com/articles => Admin::Articles controller
And it would also create named routes for articles and admin_articles. Then, you can change the first line to:
r.match('/admin').to(:namespace => 'admin') do |admin|
And you would now have:
- http://foo.com/articles => Articles controller
- http://foo.com/admin/articles => Admin::Articles controller
And all of the links throughout the app would work, assuming you used the correct named routed.