[Rails] Re: When to use optimistic locking?

Jason Tuttle
2006-05-09T18:56:19Z

Kevin Olbrich wrote:
> On Tuesday, May 09, 2006, at 8:18 PM, Jason Tuttle wrote:
>>> look like this:
>>>      else
>>> : )
>>
>>Rails@lists.rubyonrails.org
>>http://lists.rubyonrails.org/mailman/listinfo/rails
>
> It works.  I think it puts a hidden text field with the value of the
> lock_version in the form.  When you go to save it, it compares the value
> to the one in the database.  If the one in the database is different,
> then someone has modified the record.  Once saved, the value is
> incremented.
>
> So the state of the record is retained.  I think AR is smart enough to
> know what to do with this without adding additional code, which is why
> they call it a ''magic'' column.
>
> _Kevin

Hi Kevin,

I just double checked. -- There doesn''t seem to bee any hidden field.

- Jason