[Iowa-general] Using Iowa with Activerecord

Kirk Haines khaines at enigo.com
Mon Oct 4 08:41:29 EDT 2004


On Mon, 4 Oct 2004 08:49:08 +0200 (MEST), Thomas Uehlinger wrote

> I already tried to change the above methods so they only create one
> shared connection, but that didn't work, too (unless I did something
> wrong there...)

Thomas,

Try wrapping every use of AR in a transaction.

Something.transaction do
  #...your code that uses AR
end

I did a little chatting with some other AR folks, and it sounds like the 
problem is that AR is fundamentally not thread safe, but wrapping everything 
explictly in a transaction might circumvent the problem.

I really hope that this works because it doesn't seem like an onerous 
workaround, and it would be unfortunate if AR could not be used with IOWA 
just because IOWA uses threads.


Thanks,

Kirk



More information about the Iowa-general mailing list