#5 new
Amir Helzer

active_record_context prevents object.reload from database

Reported by Amir Helzer | September 27th, 2007 @ 08:01 AM

When active_record_context is called in an around filter, object calls to .reload() don't actually go to the database. The objects get loaded from memory.

As a result, if optimistic locking is used, the transaction will keep failing indefinitely.

What I do is:

while !ok {

ok = object.save

if !ok

object1.reload

... reapply my changes to the objects ...

end

}

When active_record_context, this just fails forever as the stale object is never really refreshed from the database.

I've tried patching this, but it seems that my Ruby/Rails skills are not yet up to it...

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages