gpt4 book ai didi

ruby-on-rails - Rails 路由弃用警告

转载 作者:太空宇宙 更新时间:2023-11-03 17:32:21 25 4
gpt4 key购买 nike

我有一个 Rails 4.2.1 应用程序并在我的 routes.rb 中收到弃用警告

DEPRECATION WARNING: Defining a route where `to` is a controller without an action is deprecated. Please change `to: :super_admin` to `controller: :super_admin`. (called from block in <top (required)>

路线看起来像这样:

 get "/super_admin(/:action(/:id))", :to => "super_admin", :constraints => {:subdomain => "admin"}
get "/", :to => redirect("/super_admin"), :constraints => {:subdomain => "admin"}
get "/super_admin(/:action(/:id))", :to => "super_admin", :constraints => {:subdomain => "admin.staging"}
get "/", :to => redirect("/super_admin"), :constraints => {:subdomain => "admin.staging"}
get "/super_admin(/:action(/:id))", :to => redirect("/")

我必须改变什么?

最佳答案

使用 controller: :super_admin 而不是 to: :super_admin。弃用警告消息中也提到了这一点。

关于ruby-on-rails - Rails 路由弃用警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30615343/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com