<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kamatimaru</author_name>
  <author_url>https://blog.hatena.ne.jp/kamatimaru/</author_url>
  <blog_title>delhi09の勉強日記</blog_title>
  <blog_url>https://kamatimaru.hatenablog.com/</blog_url>
  <categories>
    <anon>Rails</anon>
  </categories>
  <description>RailsでActiveRecordのfind_byにモデルのインスタンスを渡すとidに変換されるという仕様を発見しました。実務に役立つことはあまりなさそうですが、面白かったのでメモしておきます。 検証 まずは任意のモデルのインスタンスを取得します。 app(dev):004&gt; o1 = Restaurant.find(1) Restaurant Load (36.1ms) SELECT &quot;restaurants&quot;.* FROM &quot;restaurants&quot; WHERE &quot;restaurants&quot;.&quot;id&quot; = 1 LIMIT 1 /*application='App'*/ =&gt; #&lt;Resta…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkamatimaru.hatenablog.com%2Fentry%2F2026%2F01%2F03%2F223221&quot; title=&quot;RailsでActiveRecordのfind_byにモデルのインスタンスを渡すとidに変換される - delhi09の勉強日記&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>2026-01-03 22:32:21</published>
  <title>RailsでActiveRecordのfind_byにモデルのインスタンスを渡すとidに変換される</title>
  <type>rich</type>
  <url>https://kamatimaru.hatenablog.com/entry/2026/01/03/223221</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
