1

I'm using Ember 1.10.0, Ember Data beta 14.1, and Ember LocalStorage Adapter 0.5.1. I have a template:

<h1>Dracula's blog</h1>

<ul>
  {{#each post in model}}
    <li>{{#link-to 'post' post}}{{post.title}}{{/link-to}}</li>
  {{/each}}
</ul>

{{#link-to 'new-post' classNames="btn btn-primary"}}New scary post{{/link-to}}

A route:

Blogger.PostsRoute = Ember.Route.extend({
  model: function() {
    return this.store.find('post');
  }
});

And am relying on Ember automatically creating an ArrayController based on an array of models being returned.

When I load the route, I get the error:

Uncaught Error: Assertion Failed: If you pass more than one argument to the each helper, it must be in the form #each foo in bar

If I switch to the {{#each model as |post|}} or {{#each model}} form, I don't get an error (except for a deprecation warning on the second form).

michael
  • 2,977
  • 3
  • 20
  • 26
  • Do you get any errors if you change it to `{{#each model}}` and remove the uses of `post`? – Oren Hizkiya Feb 10 '15 at 01:32
  • Also, where is that assertion located? Maybe you can run the same code without the Ember LocalStorage Adapter depdendency to see whether that library is causing the issue. – Oren Hizkiya Feb 10 '15 at 01:35
  • have you tried the new syntax `each model as |post|`? – andrusieczko Feb 10 '15 at 03:59
  • Can you duplicate your issue in jsbin using ember-data and fixtures – Kalman Feb 10 '15 at 15:19
  • Great suggestions, thanks! I updated the post to note that switching to the `{{#each model as |post|}}` or `{{#each model}}` forms work. And I had tried using a different adapter, so I'm pretty sure that's not the problem. – michael Feb 10 '15 at 16:49

1 Answers1

0

I just figured out that I was still compiling templates using Ember.Handlebars.precompile(template);, which I'm shocked worked at all! Switching to Ember.HTMLBars.compile(template); fixed the issue. Thanks for all of the helpful comments, especially @Kalman - trying to reproduce in jsbin led me to the solution.

michael
  • 2,977
  • 3
  • 20
  • 26