ruby on rails - Nested Routes alternative -
i having problems nesting resources. want find out if there better way of doing things.
i have to-do list application 3 resources user, list , task. each user has his/her own todo list.
my question how else can set associations , routes prevent me nesting 3 layer deep in route file.
resources :users resources :list resources :task end end end
i want prevent that. cheers
since user can see her/his own lists , tasks, don't have nest these resources. define them separately in routes file:
resources :users resources :lists resources :tasks end
and retrieve current user authentication framework:
class listscontroller < applicationcontroller def index @lists = current_user.lists end end
Comments
Post a Comment