[Rails] Re: Re: When to use optimistic locking?

Jason Tuttle
2006-05-09T19:22:35Z

Jeremy Kemper wrote:
> On May 9, 2006, at 11:18 AM, Jason Tuttle wrote:
>> The more I think about it, there doesn''t seem to be a way to
take
>> advantage of Active Record''s  optimistic locking when using
the
>> standard
>> scaffold generated CRUD approach because the model state is lost
>> between
>> the call to "edit" and the subsequent call to
"update". -- The
>> ActiveRecord::StaleObjectError will never be thrown.
>>
>> Do you have to manually track the value of the lock_version column?
>
> Yes.
>
>> There must be a more elegant solution.
>
> Wrap up the lock_version handling by passing it in session, crypted
> form param, or similar.
>
>> I must be missing something. I just can''t figure out what.
>
> A well-tested patch?  :)
>
> Michael Schuerig did quite a bit of work on an alternate scaffolding
> toolset that includes conflict resolution.  See his Boilerplate lib:
>    http://www.schuerig.de/michael/boilerplate/
>
> Best,
> jeremy

Thanks Jeremy. -- I''m off to check out Boilerplate lib right now.

- Jason