0

以下是redmine 的 todos 插件的路线,但它采用 rails 2 方式

 map.resources :todos, :name_prefix => 'project_', :path_prefix => '/projects/:project_id',
  :member => {:toggle_complete => :post }, :collection => {:sort => :post}

 map.with_options :controller => 'mytodos' do |mytodos_routes|
  mytodos_routes.new_personal_todo 'mytodos/:parent_id/new', :action => 'new'
  mytodos_routes.connect 'mytodos/:parent_id/new.:format', :action => 'new'
 end

请帮我以rails 3方式转换它。
谢谢。

编辑:这是我所做的,但不知道天气是否正确

  RedmineApp::Application.routes.draw do
  scope ':project_id' do

resources :todos, :name_prefix => 'project_' do

  member do
    post :toggle_complete
  end

  collection do
    post :sort
  end

 end

end


 scope ':user_id' do

  resources :todos, :name_prefix => 'user_' do

  member do
    post :toggle_complete
  end

  collection do
    post :sort
  end

end

   end

   match 'mytodos/index',:to => 'mytodos#index', :via => 'get'
4

1 回答 1

0

看起来您的范围调用不正确。

但更重要的是……如果你已经完成了工作,你怎么不知道它是否有效?

于 2012-06-15T20:54:45.213 回答