2010-10-04 169 views
2

我想端口超过我的Rails 2.3.5应用到Rails 3,并具有以下路由配置的麻烦:Rails3中的子域路由

ActionController::Routing::Routes.draw do |map| 
    map.app '', :controller => 'projects', :action => 'index', :conditions => {:subdomain => true} 

     map.with_options :controller => 'site', :action => 'page', :subdomain => false, :conditions => {:subdomain => false} do |site| 
     site.site    '',  :path => 'index' 
     site.pricing   'pricing', :path => 'pricing' 
     site.tour    'tour', :path => 'tour' 
     site.about   'about', :path => 'about'  
     site.contact   'contact', :path => 'contact' 
     site.privacy   'privacy', :path => 'privacy'  
     site.terms   'terms', :path => 'terms' 
     end 
    end 

轨道2.3.5应用使用子域名,甫子域的条件......我如何用Rails 3做到这一点?我想要2条空白路线。如果子域存在,它会路由到应用程序,如果没有子域名,它应该路由到该网站。

+0

我一直在想弄清楚同样的事情。 – GeekJock 2010-10-04 03:10:50

回答