ActiveRecord::Base.transaction MySQL Lock Errors

Hi there,

is there any known issues when using ActiveRecord::Base.transaction with
models who tables have constraints applied?

I have two models:
one (is associated with model two)
two (has MySQL foreign key and unique key constraints)

I’m doing something like this:

two.create(reference to one)

two.create(reference to one)

… which leads to something hanging and the transaction failing with
MySQL table lock errors. What’s strange is that all works if I wrap each
pair of creates within a Base.transaction of their own. Any pointers on
the cause?

Thanks in advance!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs