为什么我的重定向不适用于/?

时间:2018-01-12 03:01:16

标签: ruby-on-rails routes

我在routes.rb

的顶部有这个重定向
constraints subdomain: 'www' do
  get ':any', to: redirect(subdomain: nil)
end

它适用于除“/".

之外的所有内容

因此,它适用于www.example.com/foo - > example.com/foo,但它不适用于www.example.com/

1 个答案:

答案 0 :(得分:0)

我不知道为什么,但为了同样的效果,在块内添加class MSELoss(_Loss): r"""Creates a criterion that measures the mean squared error between `n` elements in the input `x` and target `y`: :math:`{loss}(x, y) = 1/n \sum |x_i - y_i|^2` `x` and `y` arbitrary shapes with a total of `n` elements each. The sum operation still operates over all the elements, and divides by `n`. The division by `n` can be avoided if one sets the internal variable `size_average` to `False`. """ pass 。希望比我聪明的人可以回答为什么root to: redirect(subdomain: nil)*path不匹配