<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>haayaaa</author_name>
  <author_url>https://blog.hatena.ne.jp/haayaaa/</author_url>
  <blog_title>haayaaa’s diary</blog_title>
  <blog_url>https://haayaaa.hatenablog.com/</blog_url>
  <categories>
    <anon>Rails</anon>
  </categories>
  <description>find_or_create_byを使う際、すでにレコードがあるときはupdated_atだけ更新して欲しいと思う状況がありました。 User.find_or_create_by(name: “Hayashi”) これだと既にHayashiさんが存在する場合、updated_atは更新されません。 なので以下のようにfind_or_initiaize_byしてからアップデートしようかと考えておりました。 user = find_or_initiaize_by(name: “Hayashi”) user.update(name: “Hayashi”, updated_at: Date Time.…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhaayaaa.hatenablog.com%2Fentry%2F2019%2F12%2F24%2F213815&quot; title=&quot;updated_atだけ更新 - haayaaa’s diary&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>2019-12-24 21:38:15</published>
  <title>updated_atだけ更新</title>
  <type>rich</type>
  <url>https://haayaaa.hatenablog.com/entry/2019/12/24/213815</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
