0

My specific error message is this:

Error while processing route: debtor.index Ember.Adapter must implement find

Here is the model that I have defined:

var attr = Ember.attr, hasMany = Ember.hasMany;

export default Ember.Model.extend({
    debtor_id:                  attr(),
    debtor_full_name:           attr(),
    debtor_next_contact_date:   attr(),
    debtor_street1:             attr(),
    debtor_street2:             attr(),
    debtor_city:                attr(),
    debtor_state:               attr(),
    debtor_postal_code:         attr(),
    debtor_country_name:        attr(),
    debtor_tax_id:              attr(),
    debtor_date_of_birth:       attr(),
    debtor_email:               attr(),
    debtor_balance:             attr()
});

this.adapter = Ember.RESTAdapter.create();
this.url = 'api/rest/debtor'
this.rootKey = 'data';
this.collectionKey = 'debtors';
this.primaryKey = 'debtor_id';

Here is the Route for debtor:

import Debtor from '../models/debtor';
export default Ember.Route.extend({
    model: function(params) {
        return Debtor.find(params.debtor_id);
    }
});

My question: is using this the correct way to define those properties inside of the model (considering Ember-CLI syntax)? Is there something else that I am missing that could be causing this error?

4

1 回答 1

1

命名它并使用该变量感觉更惯用。

var DebtorModel = Ember.Model.extend({
    debtor_id:                  attr(),
    debtor_full_name:           attr(),
    debtor_next_contact_date:   attr(),
    debtor_street1:             attr(),
    debtor_street2:             attr(),
    debtor_city:                attr(),
    debtor_state:               attr(),
    debtor_postal_code:         attr(),
    debtor_country_name:        attr(),
    debtor_tax_id:              attr(),
    debtor_date_of_birth:       attr(),
    debtor_email:               attr(),
    debtor_balance:             attr()
});

DebtorModel.adapter = Ember.RESTAdapter.create();
DebtorModel.url = 'api/rest/debtor'
DebtorModel.rootKey = 'data';
DebtorModel.collectionKey = 'debtors';
DebtorModel.primaryKey = 'debtor_id';

export default DebtorModel;
于 2014-07-30T01:26:50.807 回答