我有警告的config / routes.rb中
DEPRECATION WARNING: Using a dynamic :controller segment in a route is deprecated and will be removed in Rails 5.1.
不知道如何重写删除警告。 任何文件,了解如何待办事项。 或者新的代码THX。
Rails.application.routes.draw do
post ':controller(/:action(/:id))(.:format)'
get ':controller(/:action(/:id))(.:format)'
get '/logout' => 'sessions#destroy', :as => 'logout'
get '/auth/failure' => 'sessions#failure'
post '/auth/:provider/callback' => 'sessions#create'
resources :sessions
resources :identities
root :to => 'myapp#index'
end
这里就是我所做的。 循环全部搞定,这感觉就像回到硬编码。 但我不知道如果有更好的方式,到目前为止,使用Rails 5.2测试工作
Rails.application.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
post '/auth/:provider/callback' => 'sessions#create'
get '/auth/:provider/callback' => 'sessions#create'
get '/logout' => 'sessions#destroy', :as => 'logout'
jinda_methods = ['pending','status','search','doc','logs','ajax_notice'] jinda_methods += ['init','run','run_do','run_form','end_form'] jinda_methods.each do |aktion| get "/jinda/#{aktion}" => "jinda##{aktion}" end
post '/jinda/pending' => 'jinda#index'
post '/jinda/end_form' => 'jinda#end_form'
get '/articles/my' => 'articles/my'
resources :articles
resources :identities
resources :sessions
resources :password_resets
resources :jinda, :only => [:index, :new]
root :to => 'jinda#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
文章来源: DEPRECATION WARNING: Using a dynamic :controller segment in a route is deprecated and will be removed in Rails 5.1