<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>nainaistar</author_name>
  <author_url>https://blog.hatena.ne.jp/nainaistar/</author_url>
  <blog_title>きり丸の技術日記</blog_title>
  <blog_url>https://nainaistar.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>Rails</anon>
    <anon>技術</anon>
  </categories>
  <description>当記事は問題解決に向けた記事ではありません。調べても原因が分からなかったので、事象の報告記事となります。 環境 Ruby 2.7.2 Rails 6.0.0 発生事象 ActiveRecord::Baseを継承したクラスにて、特定の条件のレコードの1行目を取得したかったので、次のようにfirstメソッドを使用していました。 User::Address.where(postCode: &quot;1112222&quot;).first module User class Address &lt; ActiveRecord::Base end end ただし、なぜか実行するタイミングによっては、どちらかのSQLが発行され…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnainaistar.hatenablog.com%2Fentry%2F2023%2F07%2F10%2F120000&quot; title=&quot;Railsでfirstを指定しているのにたまに11件取得していた（原因不明） - きり丸の技術日記&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>https://cdn-ak.f.st-hatena.com/images/fotolife/n/nainaistar/20220226/20220226220608.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2023-07-10 12:00:00</published>
  <title>Railsでfirstを指定しているのにたまに11件取得していた（原因不明）</title>
  <type>rich</type>
  <url>https://nainaistar.hatenablog.com/entry/2023/07/10/120000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
