Having an attachment with a name 'attachment' breaks it.
Closed this issue · 1 comments
esbanarango commented
I have my model like this:
import DS from 'ember-data';
import Attachable from '../../mixins/attachable';
export default DS.Model.extend(Attachable, {
defaultText: DS.attr('string'),
attachmentUrl: DS.attr('string'),
maxCharacters: DS.attr('number'),
singleLine: DS.attr('boolean'),
attachment: 'attachment', // The name of my attachment is also attachment
...
});
Having an attachment with a name 'attachment' breaks all the mixin funcionality, I had to open the mixin attachable.js
and change that behaviour:
....
attachmentKey = this.get('attachment');
data = Ember.copy(this.serialize());
Ember.makeArray(attachmentKey).forEach(function(key) {
data['attachment'] = key;
}, this);
formData = new FormData();
root = this._rootKey();
...
I'm creating an PR to change the name of attachment
to something more difficult to mach, something like "attachableName".
pavloo commented
@esbanarango that's cool, mate. do a PR - we'll merge it.