I've got the models Train and Passenger joined by Train_Passenger. Each has within it:$beforeInsert = () => { this.created_at = new Date().toISOString() this.updated_at = new Date().toISOString() } $beforeUpdate = () => { this.updated_at = new Date().toISOString() } These all work in that any of the following will create a new row in the corresponding tables with timestamps as expected:Train .query() .insert({... Passenger .query() .insert({... Train_Passenger .query() .insert({... However, this:someTrainInstance .$relatedQuery('passengers') .insert({... while it will create a passenger in the passengers table with timestamps perfectly, and it will also create the correct record in train_passengers in terms of foreign ids, BUT that record will not be timestamped.Any ideas?
Submitted March 16, 2017 at 11:40PM by coderbee
No comments:
Post a Comment