This is some really freaky behavior that I probably should have asked about earlier, as this has been endlessly frustrating.
So, my workflow that I’m trying to implement is just super basic CRUD of my models.
( Each of my objects has a few routes: index
, new
, show
, show/edit
, show/index
)
My particular problem has to do with creating new objects, and redirection to the show path.
the show path loads the show/index
route. and the show/index
route calls modelFor
on the show route to get the model.
here is the code that triggers the redirect (everything is perfect until modelFor
is called on the show route)
lines 47-50:
console.log(path);
console.log(params);
this.get('router').transitionTo(path, params);
the output of the console.logs is
events.show.levels.show
edit-form.js:50 Object {level_id: "57", event_id: "16"}
which is great, exactly what I expect from nested routing (the level_id being the id of the new object, and event_id being the parent model’s id)
the route that is being transitioned to is here
which is built from this mixin.
All of that works fine, where things get messed up is here in show/index: where I make the call to modelFor('events.show.levels.show')
. The result of modelFor
in this route is the params
that are sent to the show
route.
I’ve been super confused by this behavior, and would be extraordinarily relieved, if someone could shed some light as to what’s happening.