lundi 12 juin 2017

Error while trying to create a one to one relationship in ember.js

I am trying to create a one-to-one relationship between an account and user model in ember. When I create the model, I am thrown the error

You can no longer pass a modelClass as the first argument to store.buildInternalModel. Pass modelName instead. Error

my models:

import DS from 'ember-data';

export default DS.Model.extend({
  email: DS.attr('string'),
  account: DS.belongsTo('account')
});


import DS from 'ember-data';

export default DS.Model.extend({
  user_name: DS.attr('string'),
  content_type: DS.attr('string'),
  creator: DS.attr('boolean'),
  user: DS.belongsTo('user')
});

the account creation action in routes/create-account.js:

createAccount (params) {
      let current_user = this.get('auth.credentials.id');
      let account = this.get('store').createRecord('account', params);
      account.set('user', user);
      account.save();
    },

I have no idea what this error means or how to work around it. What is worse is that my code falls in line with that laid out in the ember docs. I also am able to write to my back end database, even with this broken code. Has anyone encountered this error before/know how to solve it?




Aucun commentaire:

Enregistrer un commentaire