<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>a2ikm</author_name>
  <author_url>https://blog.hatena.ne.jp/a2ikm/</author_url>
  <blog_title>There's an echo in my head</blog_title>
  <blog_url>https://ikm.hatenablog.jp/</blog_url>
  <categories>
    <anon>activerecord</anon>
  </categories>
  <description>ソースを見るとトランザクションを開始してからロックしてくれるので、別途transactionを呼ぶ必要はない。 # File activerecord/lib/active_record/locking/pessimistic.rb, line 69 def with_lock(lock = true) transaction do lock!(lock) yield end end 確かにトランザクション内じゃないとブロックとともにロックする意味が無いので、当たり前っちゃあ当たり前か。ドキュメントにも書いてあるし。</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fikm.hatenablog.jp%2Fentry%2F2012%2F12%2F14%2F165621&quot; title=&quot;ActiveRecordのwith_lockはトランザクションも開始してくれる - There&amp;#39;s an echo in my head&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2012-12-14 16:56:21</published>
  <title>ActiveRecordのwith_lockはトランザクションも開始してくれる</title>
  <type>rich</type>
  <url>https://ikm.hatenablog.jp/entry/2012/12/14/165621</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
