rails 3 - one app, multiple domains, how implement a different 'root' route for one of the domains?

断了今生、忘了曾经 提交于 2019-12-03 03:19:08

I usually proceed as follows:

constraints(Subdomain) do
  match "/" => "home#admin"
end

match "/" => "home#standard" 

Or:

match "/" => "home#admin", :constraints => {:subdomain => "admin"}

match "/" => "home#standard" 

Which creates:

/(.:format) {:action=>"admin", :subdomain=>"admin", :controller=>"home"}
root  /(.:format) {:action=>"standard", :controller=>"home"}

The same logic lets you create routes only available to desired subdomains.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!