0

The linkTo helper is creating <a> tags with an href that looks like this.

 <a id="ember561 class="ember-view" href="/orgs/<Organization:ember349:17>">

The url is actually the string representation of the object. The expected functionality is to link to /orgs/17 where 17 is the id of the context object.

The context I'm passing to linkTo is a model with an id, I'm sure it has an id because I can print out this.id in the template.

  #template
  {{#each orgs}}
    {{#linkTo 'organizations.show' this}} {{this.id}} {{/linkTo}}
  {{/each}}

  #router
  Router.map ->
   @resource 'organizations', path: "/orgs", ->
    @route 'show', path: ":id"
    @route 'new'

When I click on the messed up link, it transitions to '/orgs/<Organization:ember349:17>' and that page has the correct model set.

I can print {{id}} from that template and it is correct.

ember.js version = Version: v1.0.0-rc.3-292-gbdffb37
Keren Caelen
  • 1,466
  • 3
  • 17
  • 38
Chandler
  • 1,019
  • 14
  • 23
  • Do you have a `serialize` hook for that route? See http://emberjs.com/api/classes/Ember.Route.html#method_serialize – Thomas Jun 18 '13 at 10:24

1 Answers1

1

Your show route needs to define the model if you're using the default serialize method. In that case I assume :organization_id

  Router.map ->
    @resource 'organizations', path: "/orgs", ->
      @route 'show', path: ":organization_id"
      @route 'new'
Bradley Priest
  • 7,438
  • 1
  • 29
  • 33