0

Following are routes of todos plugin of redmine but it is in rails 2 way

 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

Please help me to convert it in rails 3 way.
Thanks.

EDIT: This is what I have done but does not know weather it is correct

  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'
urjit on rails
  • 1,763
  • 4
  • 19
  • 36

1 Answers1

0

It doesn't look like your scoping calls would be correct.

But on a more important note... if you've got the work done how do you not know if it works?

Matt Polito
  • 9,588
  • 2
  • 19
  • 13
  • sorry for late reply but I am getting routing error so if you can show me what is my mistake in above written code or If you can write completely new code would be great thanks. – urjit on rails Jun 19 '12 at 08:42