将rails 3中的语法从rails 2路由到3

时间:2011-09-23 05:13:33

标签: ruby-on-rails-3

我想更改以下路由语法,以便它与Rails 3.0兼容

map.namespace(:admin, :path_prefix => 'refinery') do |admin|
  admin.resources :dashboard
  admin.disable_upgrade_message 'disable_upgrade_message', :controller => 'dashboard', :action => 'disable_upgrade_message'
end

1 个答案:

答案 0 :(得分:0)

我会试一试。代码取自Fernandez: The Rails 3 Way

的示例
namespace :refinery, :controller :admins do
  resources :dashboard
  match 'disable_upgrade_message' => 'dashboard#disable_upgrade_message'
end

只需注意一句:您的控制器应命名为DashboardsController,然后路由应为resources :dashboards