Note that there are some explanatory texts on larger screens.

plurals
  1. POember-rails & handlebars: specified templateName does not exist for one view, but does for all others
    primarykey
    data
    text
    <p>I'm working up an ember-rails app that precompiles Handlebars assets through the rails pipeline. Everything is updated to the latest versions via <code>bundle update</code>.</p> <p>When we load the index, the ember data is not rendered to the list, despite (app/views/gigs/index.html.erb):</p> <pre><code>&lt;h1&gt;Gigs&lt;/h1&gt; &lt;script type="text/x-handlebars"&gt; {{ view App.ListGigsView }} &lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { App.gigsController.loadAll(&lt;%= @gigs.to_json.html_safe %&gt;); }); &lt;/script&gt; </code></pre> <p>So, I checked the ListGigsView, which contains the following (app/assets/javascripts/app/views/gigs/list.js):</p> <pre><code>App.ListGigsView = Ember.View.extend({ templateName: 'app/templates/gigs/list', gigsBinding: 'App.gigsController', showNew: function() { this.set('isNewVisible', true); }, hideNew: function() { this.set('isNewVisible', false); }, refreshListing: function() { App.gigsController.findAll() } }); </code></pre> <p>Seems like the templateName is pointing fine (this is similar in, say, new.js). Nonetheless, the browser console (Google Chrome Version 25.0.1364.172) keeps returning the following:</p> <p><code>Uncaught Error: assertion failed: You specified the templateName app/templates/gigs/list for &lt;App.ListGigsView:ember194&gt;, but it did not exist.</code></p> <p>Here is the file at app/assets/javascripts/app/templates/gigs/list.handlebars:</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;ID&lt;/th&gt; &lt;th&gt;Name&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; {{#each gigs}} {{view App.ShowGigView gigBinding="this"}} {{/each}} {{#if isNewVisible}} &lt;tr&gt; &lt;td&gt;*&lt;/td&gt; &lt;td&gt; {{view App.NewGigView}} &lt;/td&gt; &lt;/tr&gt; {{/if}} &lt;/tbody&gt; &lt;/table&gt; &lt;div class="commands"&gt; &lt;a href="#" {{action "showNew"}}&gt;New Gig&lt;/a&gt; &lt;a href="#" {{action "refreshListing"}}&gt;Refresh Listing&lt;/a&gt; &lt;/div&gt; </code></pre> <p>Why is the template not rendering? Running <code>Ember.TEMPLATES</code> in the console returns all the other view template links intact:</p> <pre><code>&gt; Ember.TEMPLATES =&gt; Object {app/templates/gigs/edit: function, app/templates/gigs/event: function, app/templates/gigs/show: function, application: function} </code></pre> <p>But not the one for <code>list</code>. Why is that template AWOL?</p> <ul> <li><p>For reference, I am running the following according to the browser console:</p> <p>Ember.VERSION : 1.0.0-rc.1 ember.js:339 Handlebars.VERSION : 1.0.0-rc.3 ember.js:339 jQuery.VERSION : 1.9.1</p></li> </ul> <p>-Edit: I have just discovered that including the Handlebars reference to the Event view in index.html.erb causes that template to disappear,too:</p> <pre><code>&lt;h1&gt;Gigs&lt;/h1&gt; &lt;script type="text/x-handlebars"&gt; {{ view App.ListGigsView }} &lt;/script&gt; &lt;script type="text/x-handlebars"&gt; {{ view App.EventView }} &lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { App.gigsController.loadAll(&lt;%= @gigs.to_json.html_safe %&gt;); }); &lt;/script&gt; </code></pre> <p>Why does this happen? And how can I avoid it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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