简体   繁体   中英

Rails Routes deprecation warning

I have a Rails 4.2.1 application and got a deprecation warning in my 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)>

routes looks like this:

 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("/")

what do I have to change?

Use controller: :super_admin instead of to: :super_admin . This is also mentioned in the deprecation warning message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM