Bläddra i källkod

member: membership dependent destoy

Lou 3 år sedan
förälder
incheckning
144083354e
3 ändrade filer med 2 tillägg och 2 borttagningar
  1. 1
    1
      app/models/user.rb
  2. 1
    1
      db/seeds.rb
  3. Binär
      erd.pdf

+ 1
- 1
app/models/user.rb Visa fil

@@ -11,7 +11,7 @@ class User < ApplicationRecord
11 11
 
12 12
   has_many :tasks, foreign_key: 'owner_id', class_name: 'Task'
13 13
   
14
-  has_many :memberships, foreign_key: :member_id
14
+  has_many :memberships, foreign_key: :member_id, dependent: :destroy
15 15
   has_many :teams, through: :memberships
16 16
   
17 17
   has_secure_password

+ 1
- 1
db/seeds.rb Visa fil

@@ -48,7 +48,7 @@ end
48 48
 User.create(username: "admin", email: "admin@email.com", password: "azerty", is_admin: true)
49 49
 puts "Created Admin"
50 50
 
51
-60.times do |i|
51
+30.times do |i|
52 52
   task = Task.create(
53 53
     name: Faker::Verb.ing_form,
54 54
     description: Faker::Fantasy::Tolkien.poem,

Binär
erd.pdf Visa fil


Loading…
Avbryt
Spara