複数の関連を跨いで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 Group belongs_to :organization, inverse_of: :groups has_many :employees, inverse_of: :group accepts