Routes 不推荐使用警告:在路由中使用dynamic:controller段是不推荐使用的,将在Rails 5.1中删除
我有带有警告的config/routes.rbRoutes 不推荐使用警告:在路由中使用dynamic:controller段是不推荐使用的,将在Rails 5.1中删除,routes,ruby-on-rails-5,Routes,Ruby On Rails 5,我有带有警告的config/routes.rb DEPRECATION WARNING: Using a dynamic :controller segment in a route is deprecated and will be removed in Rails 5.1. 不知道如何重写以删除警告。 了解如何操作的任何文档。还是新代码 Thx 这就是我所做的。 循环所有得到的,感觉就像回到硬代码。 但我不知道是否有更好的方法,到目前为止与Rails5.2beta一起使用 Rails.ap
DEPRECATION WARNING: Using a dynamic :controller segment in a route is deprecated and will be removed in Rails 5.1.
不知道如何重写以删除警告。
了解如何操作的任何文档。还是新代码
Thx
这就是我所做的。
循环所有得到的,感觉就像回到硬代码。
但我不知道是否有更好的方法,到目前为止与Rails5.2beta一起使用
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'
这就是我所做的。
循环所有得到的,感觉就像回到硬代码。
但我不知道是否有更好的方法,到目前为止与Rails5.2beta一起使用
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'
可能与新重写的“post”:controller(/:action(/:id))(:format)‘get’:controller(/:action(/:id))(:format)’的内容重复?在我看来,在网上冲浪时,动态动作/控制器已被淘汰,没有其他选择。我想这与应用程序的安全性有关。到目前为止,我找到的最好的解决方案就是将所有操作都列在白名单上,这样就可以将它们全部写出来,或者循环使用,如重复问题的答案所示。请参阅:And:,@TheR2(在本期中)为
:action
,,通过一些搜索,这可能也可以为:controller
完成。可能与新重写的“post”重复:controller(/:action(/:id))(:format)'get':controller(/:action(/:id))(:format)'?在我看来,在互联网上冲浪时,动态动作/控制器已被淘汰,没有其他选择。我想这与应用程序的安全性有关。到目前为止,我找到的最好的解决方案就是将所有动作都列在白名单上,这样就可以把它们全部写出来,或者像重复问题的答案中所显示的那样循环使用它们。请参阅:And:,@TheR2(在本期中)有一个:action
的变通方法,通过一些搜索,也许这也可以对:controller
完成。
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