瀏覽代碼

task: user dependent destroy

Lou 3 年之前
父節點
當前提交
6bfb3322f3
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      app/models/user.rb

+ 1
- 1
app/models/user.rb 查看文件

@@ -9,7 +9,7 @@ class User < ApplicationRecord
9 9
   has_many :joined_user_activities
10 10
   has_many :activities, :through => :joined_user_activities
11 11
 
12
-  has_many :tasks, foreign_key: 'owner_id', class_name: 'Task'
12
+  has_many :tasks, foreign_key: 'owner_id', class_name: 'Task', dependent: :destroy
13 13
   
14 14
   has_many :memberships, foreign_key: :member_id, dependent: :destroy
15 15
   has_many :teams, through: :memberships

Loading…
取消
儲存