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:
ActiveRecord::Base.transaction
one.create
two.create(reference to one)
one.create
two.create(reference to one)
end
… 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!