I have two tables in my project call task and params, task represents work task and params are the param list of that task. they are one2many relationship. params has a column called task_id which contains the id of the task table(foreign key).
Here I insert a row into the task table and then insert some rows into params table:
1.task.create(vals)
2.params.create(param_vals)
But due to the transaction when the 2 line is executed the task was not inserted so the task_id was not generated. How to avoid this?