In my rails app I have a Task model. In my app, my tasks can have substasks and so on. Since my subtasks are tasks with only a parent task, I did a self-nested model such as
class Task < ActiveRecord::Base ## Self Join has_many :subtasks, class_name: "Task", foreign_key: "parent_task_id" belongs_to :parent_task, class_name: "Task" ## end
I have now a trouble making routes for this model.
I naively thought that it would be that simple. Here it is:
resources :tasks do resources :tasks end
The result I try to acheive is by going to this url : "/tasks/1/tasks" is that I can render (by the way, in all my controllers I curently render in JSON not using views) the tasks that have as parent_task_id 1.
Hope you understand my request.
Thanks in advance ;)