How to create a second level route in Rails?
I'm trying to get the following spec to work. So far I've had some success with making both of these cases work:
开发者_Go百科User/Tasks
-- Lists user's tasks.User/Projects
-- List user's projects.
But how do I get User/Project/Tasks
to list all the tasks in the Project (all tasks in project, not just the user's tasks in the project)?
My routes.rb is as following:
resources :users do
resources :tasks, :through => :projects
resources :projects
end
Can it not simply be accomplished with?
resources :users do
resources :projects do
resources :tasks
end
end
Feel free to keep the other route for :tasks
around .. you'll just have to handle which case it is in your TasksController
.
精彩评论