Skip to content

fragment error #15

@basz

Description

@basz

Hi,

can ember-data-copyable work with fragments? As soon as I make a fragment copyable the base model will not copy anymore Fragment.extend(Copyable.

Assertion Failed: You can only assign null, an object literal or a 'dossier/consumer' fragment instance to this property"

property is 'consumer'.
and value is an 'instance'
error comes from here : https://github.com/lytics/ember-data-model-fragments/blob/master/addon/attributes.js#L118

adding console.log(value) reveals two passing calls, and the last one fails, which looks different to me.

[Log] Class {__ember1513363568481: "ember1394", store: Class, _internalModel: InternalModel, currentState: Object, …} (vendor.js, line 128420)
[Log] Class {__ember1513363568481: "ember1395", store: Class, _internalModel: InternalModel, currentState: Object, …} (vendor.js, line 128420)
[Log] Class {__ember1513363568481: null, fn: function, args: [false], context: Class, owner: Class, …} (vendor.js, line 128420)
export default Model.extend(Copyable, Validations, {
  dossierNumber: attr('string'),
  openedDate: attr('date', { defaultValue: () => new Date() }),
  owningCustomerId: attr('string'),
  owningPracticeId: attr('string'),

  consumer: fragment('dossier/consumer', { defaultValue: {} }),
});

export default Fragment.extend(Copyable, Validations, {
  address: fragment('fragment/geography/address', { defaultValue: {} }),
  birthday: attr('date'),
  email: attr('string'),
  name: fragment('fragment/person/name/personname', { defaultValue: {} }),
  phone: attr('string'),
  sex: attr('string'),
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions