Ember CLI 1.13.14 Ember 2.5 Ember-Data 2.5
I have an application with two models.
// bulkpayment.js
export default DS.Model.extend({
bookingId : DS.attr(),
leadName : DS.attr(),
bookingRef : DS.attr(),
dateTravel : DS.attr(),
paidAmt : DS.attr(),
dueAmt : DS.attr(),
requsitionAmt : DS.attr(),
dateDue : DS.attr()
});
//bulkcostrequisitiom.js
export default DS.Model.extend({
transType : DS.attr(),
dateTrans : DS.attr(),
bulkPayments : hasMany('bulkpayment')
});
I perform a search using this.store.query('bulkpayment', filter)
to retrieve all of the required records. These are loaded and displayed to the user.
The user then selects the records that they wish to pay, enters the amount to pay in the requisitionamt field and presses the Requisition Payments
button on my form.
I then create a new bulk cost requisition record
let bcr = this.store.createRecord('bulkcostrequisition');
Set the transType and dateTrans
bcr.transType = '1';
bcr.dateTrans = Date.now();
And add all of the selected records (in this case all records)
bcr.get('bulkPayments').pushObjects(this.store.peekAll('bulkpayment'));
I then attempt to save the bulk cost requisition record
this.get('bulkcostrequisition').save();
This calls the correct method on the server and passes up the information, however, it only passes the id and the type of object in the relationship (hasMany) bulkPayments field as can be seen below.
Is there a way to also send the attributes?
Aucun commentaire:
Enregistrer un commentaire