<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hkob</author_name>
  <author_url>https://blog.hatena.ne.jp/hkob/</author_url>
  <blog_title>hkob’s blog</blog_title>
  <blog_url>https://hkob.hatenablog.com/</blog_url>
  <categories>
    <anon>Rails</anon>
    <anon>Blogmas</anon>
  </categories>
  <description>Rails Tipsの9回目の記事では、modelのテストを簡単に書くためのshared_exampleの紹介が続いています。この記事では、「親削除時にnullを設定」について説明しています。親が削除された場合に関連が消えることを確認するテストであり、具体的な例として受検生が学生や入学情報と関連している場合を挙げています。また、このテストを正しく動作させるためには、belongs_toのoptionalオプションを使用し、has_manyのdependentオプションにnullifyを設定する必要があることも説明されています。 (要約 by Notion AI)</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhkob.hatenablog.com%2Fentry%2F2023%2F12%2F09%2F070000&quot; title=&quot;親削除時にnullを設定 shared_example: 小林研 Rails Tips (9) - hkob’s blog&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>2023-12-09 07:00:00</published>
  <title>親削除時にnullを設定 shared_example: 小林研 Rails Tips (9)</title>
  <type>rich</type>
  <url>https://hkob.hatenablog.com/entry/2023/12/09/070000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
