Note that there are some explanatory texts on larger screens.

plurals
  1. POEmber - Object has no method 'map'
    primarykey
    data
    text
    <p>I am going through the ember.js guides to learn Ember, and I am using the latest builds of <a href="http://builds.emberjs.com.s3.amazonaws.com/ember-latest.js" rel="nofollow">ember.js</a>, <a href="http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.js" rel="nofollow">ember-data.js</a>, and handlebars.js. I am able to successfully set up a basic nav that switches between views. However, upon trying to integrate a model with a <code>{{#each model}}</code>, I get an error message: Uncaught TypeError: Object # has no method 'map' </p> <p>Many people seem to have asked a related question, but the solution has always been to update the version of ember, which I have already done.</p> <p>I believe have followed the tutorial precisely and my code so far is as follows.</p> <pre><code>App = Ember.Application.create(); App.Store = DS.Store.extend({ revision: 12, // Says we are specifying all models in js adapter: 'DS.FixtureAdapter' }); App.Router.map(function() { this.resource('posts'); this.resource('about'); }); App.PostsRoute = Ember.Route.extend({ model: function() { return App.Post.find(); } }); App.Post = DS.Model.extend({ title: DS.attr('string'), author: DS.attr('string'), intro: DS.attr('string'), extended: DS.attr('string'), publishedAt: DS.attr('date') }); App.Post.FIXTURES = ({ id: 1, title: 'Book Title', author: 'Dave', publishedAt: new Date('12-27-2012'), intro: 'This is an introduction to the book', extended: 'This is an even longer introduction to the book' }, { id: 2, title: 'Book Title 2', author: 'James', publishedAt: new Date('08-13-2012'), intro: 'This is an introduction to another book', extended: 'This is an even longer introduction to another book' }); </code></pre> <p>And the relevant markup:</p> <pre><code>&lt;script type="text/x-handlebars"&gt; &lt;div class="navbar"&gt; &lt;div class="navbar-inner"&gt; {{#linkTo 'index' classNames='brand'}}Brand{{/linkTo}} &lt;ul class="nav"&gt; &lt;li&gt;{{#linkTo 'about'}}About{{/linkTo}}&lt;/li&gt; &lt;li&gt;{{#linkTo 'posts'}}Posts{{/linkTo}}&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; {{outlet}} &lt;/script&gt; &lt;script type="text/x-handlebars" id="about"&gt; &lt;div class="about"&gt; &lt;p&gt;Here is some text about the page&lt;/p&gt; &lt;/div&gt; &lt;/script&gt; &lt;script type="text/x-handlebars" id="posts"&gt; &lt;div class="container-fluid"&gt; &lt;div class="row-fluid"&gt; &lt;div class="span3"&gt; &lt;table class='table'&gt; &lt;thead&gt; &lt;tr&gt;&lt;th&gt;Recent Posts&lt;/th&gt;&lt;/tr&gt; &lt;/thead&gt; {{#each model}} &lt;tr&gt; &lt;td&gt;&lt;a href="#"&gt;{{title}} &lt;small class='muted'&gt;by {{author}}&lt;/small&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; {{/each}} &lt;/table&gt; &lt;/div&gt; &lt;div class="span9"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/script&gt; </code></pre> <p>All help is much appreciated, and sorry if the formatting of this question is awful - it's my first question! Cheers!</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