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