处理路径时出现Ember错误:索引断言失败:无法找到模型

时间:2015-08-24 11:11:43

标签: ember.js ember-data ember-cli fixtures

我有我的索引页面,其中显示了用户可以单击以创建和编辑它们的发票列表,我在我的适配器中使用DS.FixtureAdapter

问题是我收到此错误

处理路径时出错:索引断言失败:无法找到模型的夹具

如果在我的模型中我重新打开这样的课程,一切正常

Invoice.reopenClass({
  FIXTURES: [
    {
      id          : '1',
      name        : 'Invoice num 1',
      transactions: [1]
    }
  ]
});

所以我假设我在模板中做错了,我说如果没有发票显示我“没有发票......”

<div class="row">
    <div class="large-6 columns">
      <h3>View Invoices</h3>
        <ul class="invoices-listing">
            {{#each invoice in model}}
            <li>
                {{#link-to "invoices.show" invoice}}
                    {{invoice.name}}
                {{/link-to}}
            </li>
            {{else}}
            <li>no invoices… :(</li>
            {{/each}}
        </ul>
    </div>
    <div class="large-6 columns">
      <h3>Edit Invoices</h3>
        <ul class="invoices-listing">
            {{#each invoice in model}}
            <li>
                {{#link-to "invoices.edit" invoice}}
                    {{invoice.name}}
                {{/link-to}}
            </li>
            {{else}}
            <li>no invoices… :(</li>
            {{/each}}
        </ul>
    </div>
    <div class="large-12 columns">
      Invoices: {{InvoicesCount}}
    </div>
    <div class="large-12 columns">
      {{#link-to "Invoices.create" class="create-btn"}} Add Invoice {{/link-to}}
    </div>
</div>

路线Index.js

import Ember from 'ember';

export default Ember.Route.extend({
  model: function(){
    return this.store.find('fattura');
  }
});

这只是在我启动ember服务器时看起来像一个问题,因为例如,如果我开始创建和删除发票,我想删除所有这些,索引页面正确显示“没有发票......”

0 个答案:

没有答案