Rails routes redirection for subdomains

According to @cfernandezlinux's amazing answer, here's the same in Rails 4/Ruby 2 syntax:

constraints subdomain: "meow" do   
  get "/" => redirect { |params| "http://www.externalurl.com" }
end
  • match in routes.rb is not allowed in Rails 4.0 anymore. You have to use explicitly get, post, etc.
  • hashrocket syntax (=>) is for old Ruby, now in Ruby 2.0 we use param: 'value' syntax

I ended up doing something like this:

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