ended9월 14일· 1 sources
Rails の `dependent: :destroy` が激重になる話を簡単な例で
Why it matters
何が起きるか 親レコードを消すと、子レコードも一緒に消えて便利な dependent: :destroy (いわゆる cascade 削除)。 でも子がコールバックを持っていると、削除のたびにそれが発火します。 class Author < ApplicationRecord has_many :books, dependent: :destroy end class Book < Applica...
1
Sources
+0
24h
—
Growth
4d
Active