在 Rails 3.2.11 应用程序中,我有以下路线可以将 www 重定向到非 www:
constraints(:host => /www.foo.com/) do
root :to => redirect("http://foo.com")
match '/*path', :to => redirect {|params| "http://foo.com/#{params[:path]}"}
end
无论如何 rspec 会引发以下警告:
DEPRECATION WARNING: redirect blocks with arity of 1 are deprecated. Your block must take 2 parameters: the environment, and a request object. (called from block (2 levels) in <top (required)> at /foo/config/routes.rb:6)
我无法在谷歌上找到一些东西,所以我想问问是否有人知道我如何摆脱这个警告。
谢谢