Note that there are some explanatory texts on larger screens.

plurals
  1. PORendered template is not loading relevant model
    text
    copied!<p>Relevant information</p> <ul> <li>I have a Rails 4.0 API server set up for data persistence, using ember-rails.</li> <li>Ember Version: 1.3.0-beta.1+canary</li> <li>Ember-Data Version: 1.0.0-beta.4+canary</li> </ul> <p>Say I have a Categories model that contains a list of categories. I would like to render this at the Application level to be used as navigation.</p> <p>Here is what I have</p> <pre><code># templates/application.hbs {{ render categories }} {{ outlet }} # templates/categories.hbs &lt;h1&gt;Categories&lt;/h1&gt; {{#each category in controller}} {{#link-to 'category' category}} {{category.title}} {{/link-to}} {{/each}} # routes/categories.js.coffee App.CategoriesRoute = Ember.Route.extend model: -&gt; @store.find 'category' # models/category.js.coffee App.Category = DS.Model.extend title: DS.attr('string'), slug: DS.attr('string') # router.js.coffee App.Router.map -&gt; @resource 'categories', path: 'categories' @resource 'category', path: 'category/:slug' </code></pre> <p>Accessing the /#/categories path renders what I expect; a double of headings and the list of links, each pointing to a category.</p> <p>If I access the root of the app (Application.Index) at '/', I am expecting to see the same result, albeit only a single rendering of a list of links. However, what results is just the single heading and no links. Using the Ember Inspector, it looks like there isn't a model tied to the {{ render categories }}.</p> <p>From my understanding, rendering a template will use the relevant controller and view. What would be the correct way to bind the relevant model to the rendered template? Or better yet, what would be the best practice to achieve the same result?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload