views:

148

answers:

1

I am trying to port over my Rails 2.3.5 app to Rails 3, and having trouble with the following route configurations:

 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

The rails 2.3.5 app is using subdomain-fu for the subdomain condition... how do I do this with Rails 3? I want to have 2 blank routes. If a subdomain is present, it routes to the app, if there is no subdomain, it should route to the site.

+1  A: 

Just take a detailed look at railscast exactly about the sub-domain problem.

khmarbaise