I have the following polymorphic model:
/encounter.js
import DS from 'ember-data';
export default DS.Model.extend({
type: DS.attr('String'),
dateOfEncounter: DS.attr('date'),
surgeries: DS.hasMany('surgery', {async: true, polymorphic: true})
});
/surgery.js
import DS from 'ember-data';
import Encounter from './encounter';
export default Encounter.extend({
surgeon: DS.attr('string'),
encounter: DS.belongsTo('encounter', {async: true, polymorphic: true})
});
Controller:
patient.then(function(pat) {
var clinicvisit = self.store.createRecord('surgery', {
type: self.get('type'),
dateOfEncounter: dateOfEncounter,
preoperativeDiagnosis: self.get('selected'),
patient: pat,
encounter: this
});
When I create a surgery record, I am able to specify the type and dateOfEncounter (which are properties of the parent object) successfully, but in the ember inspector the parent object that is created simultaneously (encounter) has "undefined" properties. Is there anyways to specify the attributes of the parent object as well as the child object?
Aucun commentaire:
Enregistrer un commentaire