<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>imaizumimr</author_name>
  <author_url>https://blog.hatena.ne.jp/imaizumimr/</author_url>
  <blog_title>Eggshell</blog_title>
  <blog_url>https://imaizumimr.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby on Rails</anon>
  </categories>
  <description>find_or_create_by は引数に渡した条件のレコードがなければ create する。 find_or_initialize_by は引数に渡した条件のレコードがなければ new する。 返り値はレシーバのmodel。 引数に渡した条件は AND で検索されるので、このメソッドだけで create_or_update みたいに使うことはできない。 Book.find_or_create_by(id: 5) # &lt;Book id: 5, title: nil, created_at: &quot;2020-09-28 04:13:23&quot;, updated_at: &quot;2020-09-28 04:1…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fimaizumimr.hatenablog.com%2Fentry%2F2020%2F09%2F29%2F012937&quot; title=&quot;find_or_initialize_by と find_or_create_by の違い - Eggshell&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>2020-09-29 01:29:37</published>
  <title>find_or_initialize_by と find_or_create_by の違い</title>
  <type>rich</type>
  <url>https://imaizumimr.hatenablog.com/entry/2020/09/29/012937</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
