<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/992#discussion_r32369050">app/models/relation.rb</a>:</p>
<pre style='color:#555'>> @@ -248,6 +248,9 @@ def preconditions_ok?(good_members = [])
>        model = Kernel.const_get(m[0].capitalize)
>        # get the element with that ID
>        element = model.find_by(:id => m[1])
> +      # if found, lock the element to ensure it can't be deleted until
> +      # after the current transaction commits.
> +      element.lock!("for share") unless element.nil?
</pre>
<p>The rails docs seem to suggest that <code>lock!</code> reloads the row, so wouldn't cause a race condition. However, this means its doing two queries where one would be enough, so it's definitely worth making your change.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/openstreetmap/openstreetmap-website/pull/992/files#r32369050">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABWnLRwsyWitRrMz9em9DvhXL2Bz_7-9ks5oS-QmgaJpZM4FBkjZ.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/openstreetmap/openstreetmap-website/pull/992/files#r32369050"></link>
    <meta itemprop="name" content="View Pull Request"></meta>
  </div>
  <meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>