开发者

Subdomain routing in rails 3.1 not working any more?

开发者 https://www.devze.com 2023-04-01 22:10 出处:网络
I usually have my admin area on a subdomain with the following routing: scope :module => \"admin\", :as => \"admin\", :constraints => { :subdomain => \"admin\" } do

I usually have my admin area on a subdomain with the following routing:

  scope :module => "admin", :as => "admin", :constraints => { :subdomain => "admin" } do    
    root :to => 'admin#home'
  end

  root :to =开发者_StackOverflow社区> 'pages#home'

However this subdomain routing no longer works in rails 3.1, is there something extra I'm missing now?


Found this in the Rails 3.1 release notes:

named url helpers now accept :subdomain and :domain as options

So it makes me think that now you should write your route like this:

scope :module => "admin", :as => "admin", :subdomain => "admin" do    
  root :to => 'admin#home'
end

I haven't tried it yet, so let us know if that works.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号