I think you'd want a database transaction around the whole action too,
otherwise there's a race condition either way.

mark

On Fri, Nov 19, 2010 at 12:08 AM, Simon Russell <[email protected]> wrote:
> What do you do if both people submit the form at the same time?
> Wouldn't lock_version do a better job?
>
> On Fri, Nov 19, 2010 at 11:01, Eaden McKee <[email protected]> wrote:
>> What I do is when making an edit form, I have a hidden field - last
>> changed at - this is the last updated at field from rails.
>>
>> On edit submit, I load the last updated time of the object I'm saving.
>> If it has changed then I know someone has edited the object since.
>> Could use some ajax to poll for this change and warn the user before
>> they submit too.
>>
>> Eaden
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
>



-- 
A UNIX signature isn't a return address, it's the ASCII equivalent of a
black velvet clown painting. It's a rectangle of carets surrounding a
quote from a literary giant of weeniedom like Heinlein or Dr. Who.
        -- Chris Maeda

-- 
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