If you're very sure about what you're doing -- that means on UI you have both standalone lesson and nested lesson under course -- you can do this way (hope you understand CoffeeScript, it's not hard):
@resource 'course', path: ':course_id', ->
@route 'info'
@resource 'course.lesson', ':lesson_id' ->
@resource 'lesson', ->
This gives you different routes and urls. Then you can generate links like this:
{{link-to "Nested Lesson" "course.lesson" course lesson}}
{{link-to "Lesson" "lesson" lesson}}
This way, you have two lesson routes that can not be the same. You can use inheritance or mixin to reuse functionalities, like use the same controller/view/template.
App.LessonRoute = Em.Route.extend
controllerName: 'lesson'
templateName: 'lesson' # Or use viewName if you need to define a view
model: ->
# get lesson
App.CourseLessonRoute = App.LessonRoute.extend
model: ->
# get lesson from course
# No need to define "CourseLessonController"
App.LessonController = Em.ObjectController.extend()
For comments, if you wish, you can use the same way. But I think you don't really need to define a url for comment. In this way you can just use setupController
and renderTemplate
to render CommentsController
to comments outlet
App.LessonRoute = Em.Route.extend
setupController: (controller, model) ->
@_super.apply(@, arguments)
comments = model.get('comments') # Just an example code to get comments
@controllerFor('comments').set 'model', comments
renderTemplate: ->
@_super.apply(@, arguments)
@render 'comments',
into: 'lesson'
outlet: 'comments'
controller: 'comments' # Not sure if this option can be ignored.
And your lesson
template:
{{outlet comments}}