On 19 November 2010 08:47, Korny Sietsma <[email protected]> wrote:

> You should still think carefully about what it is you are trying to do.
> If you just catch the optimistic locking exception, and automatically
> reload and save, then you are ensuring the second user's change overwrites
> the first.  The second user will never see the first user's change.  That's
> not really optimistic locking at all.
>

Yep. And this is how AR (basically most of ORMs) works by default - last
wins. Nothing to do with the locking.
Wondering why not just use a proper database transaction if atomicity is a
requirement?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to