<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>a2ikm</author_name>
  <author_url>https://blog.hatena.ne.jp/a2ikm/</author_url>
  <blog_title>There's an echo in my head</blog_title>
  <blog_url>https://ikm.hatenablog.jp/</blog_url>
  <categories>
    <anon>rails</anon>
    <anon>activerecord</anon>
    <anon>actioncontroller</anon>
  </categories>
  <description>複数の関連を跨いでaccepts_nested_attributes_forを使う場合の話。 たとえば Organization has_many Groups Group has_many Employees というモデルに対して、1度にまとめてこれらのレコードを作成したい場合には次のようにする。 まずはクラスの定義: class Organization has_many :groups, inverse_of: :organization accepts_nested_attributes_for :groups # attributes: # name:string end class…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fikm.hatenablog.jp%2Fentry%2F2014%2F04%2F03%2F170115&quot; title=&quot;accepts_nested_attributes_forを多段で使う - There&amp;#39;s an echo in my head&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>2014-04-03 17:01:15</published>
  <title>accepts_nested_attributes_forを多段で使う</title>
  <type>rich</type>
  <url>https://ikm.hatenablog.jp/entry/2014/04/03/170115</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
