1
我有被分成三個單元的位點(子域):子域與資源在Rails 3
example.com # Main Site
archive.example.com # Searchable Archive
admin.example.com # CMS
在的config/routes.rb
底部我映射所述子域和根如下:
match "/" => "archive#index", constraints: {subdomain: "archive"}
match "/" => "admin#index", constraints: {subdomain: "admin"}
root :to => "pages#index
我有多少資源這是目前聲明如下:
resources :users
resources :themes
resources :downloads
有了這一套了,資源在所有子域名可用,所以對於users
資源的以下都是有效的:
archive.example.com/users
admin.example.com/users
example.com/users
如何設置我的路由,以便users
是管理員子站點下才能使用? 訪問archive.example.com/users
或example.com/users
應導致路由錯誤。