2012-12-05 122 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