I've three models Project
, Card
and Task
.
project has_many :cards
card has_many :tasks
I've defined the route for building cards like following:
resources :projects, except: [:new, :edit, :show] do
resources :cards do
resources :tasks
end
end
It'll create path for cards as: projects/:project_id/cards/
It'll create path for tasks as: projects/:project_id/cards/:card_id/tasks
What I need is:
Card routes should be nested to Project. (which I currently have) and Task routes should nested to only Card like /cards/:card_id/tasks
(which I need).
How can I achieve that?
Thanks in advance!