I am trying to create a route to add a child entity on a parent. My router looks something like this. I have a nested route in the parent's show, which I'm pretty sure is wrong. Doing this seems to stop the URL changing between page transition, and when I navigate to the addChild route from the parent's template through the {{action doAddChild href=true}}
, the :parent_id in the URL is undefined. I'm guessing this is because I'm not setting the context on the action which should be the parent, but where do I get that from?
What's the best way to achieve this? I'm obviously barking up the wrong tree...
App.Router = Ember.Router.extend
enableLogging: true
root: Ember.Route.extend
index: Ember.Route.extend
route: "/"
parents: Ember.Route.extend
route: "/parents"
doShow: Ember.Route.transitionTo('show')
index: Ember.Route.extend
route: "/"
connectOutlets: (router) ->
router.get("applicationController").connectOutlet "parents"
show: Ember.Route.extend
route: "/:parent_id"
doAddChild: Ember.Route.transitionTo('addChild')
modelType: App.Parent
connectOutlets: (router, parent) ->
router.get("applicationController").connectOutlet "parent", parent
addChild: Ember.Route.extend
route: "/addChild"
connectOutlets: (router) ->
router.get("applicationController").connectOutlet "addChild"