[Solved] Why does this jsbin render links with "undefined" instead of IDs?


I am upgrading an app with ember (1.4.0-beta.1 -> 1.6.0-beta.3) and ember-data (1.0.0-beta.5 -> 1.0.0-beta.7). The upgrade process hasn’t been incredibly smooth.

The attached jsbin shows something that used to work fine, but now breaks. When I create a new model, the link-to helper shows “undefined” instead of the new ID.

Interestingly, even though the URL displays “undefined,” the link still works.

I can fix the issue if I change {{link-to "category.edit" this}} to {{link-to "category.edit" id}}, but I thought I should be able to pass the model directly to avoid an extra lookup.

This seems like a bug to me, but this example is so basic that I must be doing something wrong. Can anyone see it?


Are you sure this jsbin is the one you want to show us?


Oops! I should have posted this: http://jsbin.com/ucanam/4575/edit

I also updated the original comment.


I figured out the issue in that code. If you use a route parameter other than “:id” you need to define the “serialize” method for that route.