In my model I have code that looks like this:
Report = Report.new()
Report.Name = name
Report.save()
This process happens several times in a second in parallel. If I get the last inserted id it gives me the wrong results. I don't want the id of the last inserted row in the database, I want the id of the actual inserted row. How do I do this?
report = Report.new
report.name = name
report.save
p report.id # here you get the id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With