2
我目前得到的錯誤:的Rails 3.1的子域控制器的基於路由
No route matches [GET] "/tenant_admin"
我用的是一樣的東西:
http://example.com/accounts/1/tenant_admin
但我現在經過帳戶ID作爲子域;
http://AccountName.example.com/
是否有可能使URL的工作是這樣的:
http://AccountName.example.com/tenant_admin?
Routes.rb
get "log_out" => "sessions#destroy", :as => "log_out"
get "log_in" => "sessions#new", :as => "log_in"
get "sign_up" => "users#new", :as => "sign_up"
resources :users
resources :sessions
resources :password_resets
resources :accounts do
resources :tenant_admin
end
constraints(Subdomain) do
match '/' => 'accounts#show'
end
root :to => "welcome#index"
你可以做到。要看看如何在rails 3.x中做到這一點,而不使用任何額外的插件檢出這個railscasts插曲http://railscasts.com/episodes/221-subdomains-in-rails-3?autoplay=true –
謝謝。我有點工作。我真正的問題是路由第三種類型的網址。 –