Schienen Strecken, url und subdomains

Meine ruby app gliedert sich in verschiedene namespaces.
wie: gratis(free.domain.com), pro(pro.domain.com), vip(vip.domain.com)
In der Routen-Datei sieht wie folgt aus:

namespace :free do
  match 'home' => 'free#home', :via => [:get, :post], :as => :home
  #more routes
end

namespace :pro do
  match 'home' => 'pro#home', :via => [:get, :post], :as => :home
  #more routes
end

namespace :vip do
  match 'home' => 'vip#home', :via => [:get, :post], :as => :home
  #more routes
end

match '/about'                => 'pages#about'
match '/team'                 => 'pages#team'
match '/press'                => 'pages#press'
#more routes

Möchte ich, dass, egal wo ich bin in der app, wenn es gibt einen link, wie pro_home_path, die url sein pro.domain.com/home.

Also im Grunde, ist es möglich, in der Routen-Datei hinzufügen einer subdomain(so etwas namespace :vip, :subdomain => vip do) zum Anhängen der subdomain an den entsprechenden namespace?

EDIT: Also ich habe eine constraint constraints(:subdomain => "newsfeed") do

Aber der link, wenn ich pro_home_path, ich bin immer lvh.mir/3000/pro/home statt pro.lvh.me:3000/home

InformationsquelleAutor bl0b | 2014-02-03

Schreibe einen Kommentar