title: Rails 3: subdomain routes
body: <p>I'm trying to convert some subdomain routes from rails 2.3.x (with subdomain_routes plugin) like these:</p>
  
  <pre><code>map.subdomain :biz do |biz|
    biz.resources :users
    biz.resources :projects
  
    biz.root :controller =&gt; 'home'
  end
  </code></pre>
  
  <p>with those routes, i got urls like this:</p>
  
  <pre><code>http://biz.example.com/users # :controller =&gt; 'biz/users', :action =&gt; 'index', :subdomain =&gt; 'biz'
  </code></pre>
  
  <p>with rails3, there isn't subdomain_routes and I can't create the same kind of routes (even if I've read that is possible). Tried with this:</p>
  
  <pre><code>scope :module =&gt; :biz, :as =&gt; :biz do
    constraints(:subdomain =&gt; 'biz') do
      resources :users
      resources :projects
      root :to =&gt; 'Biz::HomeController#index'
    end
  end
  </code></pre>
  
  <p>but when trying on console, I don't get subdomain, so for:
      app.biz_users_url # <a href="http://www.example.com/users" rel="noreferrer">http://www.example.com/users</a> but not <a href="http://biz.example.com/users" rel="noreferrer">http://biz.example.com/users</a></p>
  
  <p>I've also read/watched these resources, but there's no solution to my specific problem:</p>
  
  <p><a href="http://railscasts.com/episodes/221-subdomains-in-rails-3" rel="noreferrer">http://railscasts.com/episodes/221-subdomains-in-rails-3</a>
  <a href="http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up" rel="noreferrer">http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up</a></p>
  
  <p>any suggestions? thanks in advance ;)</p>
  
  <p>A.</p>