[Rails] Re: Concurrecy question with ActiveRecord
Gleb Arshinov
gleb at barsook.com
Fri Dec 10 01:39:34 GMT 2004
>>>>> "Michael" == Michael Koziarski <koziarski at gmail.com> writes:
Michael> Point well made rick, any attempt to solve all the
Michael> locking problems in the world with AR will fail. Having
Michael> said that ... one thing that could be nice in active
Michael> record is the ability to support optimistic locking with
Michael> a timestamp column.
<snip>
Michael> SELECT t.* FROM patients WHERE id=1 UPDATE patients SET
Michael> first_name = "some_name" AND last_modified =
Michael> :current_time where id = 1 AND last_modified=
Michael> :last_modified;
Michael,
Version number (incrementing integer) or version timestamp work well
and are conceptually very simple (win-win). I've seen it done as a
version number, but otherwise exactly as you describe.
Gleb
More information about the Rails
mailing list