2012-12-05 119 views

回答

12

據@ cfernandezlinux的amazing answer,這裏是在同Rails 4/Ruby 2語法:

constraints subdomain: "meow" do 
    get "/" => redirect { |params| "http://www.externalurl.com" } 
end 
  • match在routes.rb中沒有對Rails 4.0允許了。你必須使用明確getpost
  • hashrocket語法(=>)是舊的Ruby,現在的Ruby 2.0,我們使用PARAM: '值' 語法
4

最後我做這樣的事情:

constraints :subdomain => "meow" do 
    match "/" => redirect { |params| "http://www.externalurl.com" } 
end