emberjs/ember.js — pull request #1503 by teddyzeenny (2012-10-29 22:23:16+00:00)
Title: Bug Fix: Generated href for nested routes with multiple contexts

In the case where we have nested routes, each having it's own context and these contexts share property names (not values), URL generation (when setting `href=true`) fails.

It merges all the contexts together into one hash and applies this hash to all the routes, and if these contexts share a property name (such as id), all routes will use the value of the last property due to the merge (which is not what we want).

The transition works perfectly, but the generated href is wrong.

#### Example:

```javascript
var router = Ember.Router.create({

root: Ember.Route.create({
goToComments: Ember.Route.transitionTo('root.dashboard.posts.comments'),

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

posts: Ember.Route.create({
route: '/posts/:id',
comments: Ember.Route.create({
route: '/comments/:id'
})
})
})
})
});
```

```html

Your Comment

```

Assuming `controller.post = {id: 1}` and `controller.comment = {id: 5}`

The generated href should be `/posts/1/comments/5` .
Unfortunately the generated one is `/posts/5/comments/5`

I added a failing test for this scenario, and a fix.

I modified some functions, but I made sure my changes are backwards compatible so I don't break any existing code.