我有一个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("/")
我需要改变什么?
答案 0 :(得分:5)
使用controller: :super_admin
代替to: :super_admin
。弃用警告消息中也提到了这一点。