emberjs/ember.js — pull request #1003 by rlivsey (2012-06-14 15:21:45+00:00)
Title: urlForEvent for a route with a dynamic part doesn't serialize the context

This is just a failing test for now, currently investigating.

Basically if we're in index of the following:

root: Ember.Route.create({
index: Ember.Route.create({
route: '/',
showDashboard: Ember.Route.transitionTo('dashboard'),
showActivity: Ember.Route.transitionTo('dashboard.activity')
}),

dashboard: Ember.Route.create({
route: '/dashboard/:component_id',

activity: Ember.Route.create({
route: '/activity'
})
})
})

then:

> router.urlForEvent('showDashboard', { id: 1 });
=> #!#/dashboard/1

but going into the sub-state with the same context:

> router.urlForEvent('showActivity', { id: 1 });
=> #!#/dashboard/undefined/activity

this is because it's not calling serialize on the intermediate state, but on the final state which doesn't know how to transform `{id: 1}` into `{component_id: 1}`

If we call it with a pre-serialized hash then it "works":

> router.urlForEvent('showActivity', { component_id: 1 });
=> #!#/dashboard/1/activity

It looks like urlForEvent will have to walk back up the parent states calling serialize on each one which has a dynamic route?