Add destroy dependencies to models
This commit is contained in:
parent
18049385ce
commit
53e6e8bd39
2 changed files with 4 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
class Party < ApplicationRecord
|
class Party < ApplicationRecord
|
||||||
##### ActiveRecord Associations
|
##### ActiveRecord Associations
|
||||||
belongs_to :user, optional: true
|
belongs_to :user, optional: true
|
||||||
has_many :characters, foreign_key: "party_id", class_name: "GridCharacter"
|
has_many :characters, foreign_key: "party_id", class_name: "GridCharacter", dependent: :destroy
|
||||||
has_many :weapons, foreign_key: "party_id", class_name: "GridWeapon"
|
has_many :weapons, foreign_key: "party_id", class_name: "GridWeapon", dependent: :destroy
|
||||||
has_many :summons, foreign_key: "party_id", class_name: "GridSummon"
|
has_many :summons, foreign_key: "party_id", class_name: "GridSummon", dependent: :destroy
|
||||||
end
|
end
|
||||||
|
|
@ -2,7 +2,7 @@ class User < ApplicationRecord
|
||||||
before_save { self.email = email.downcase }
|
before_save { self.email = email.downcase }
|
||||||
|
|
||||||
##### ActiveRecord Associations
|
##### ActiveRecord Associations
|
||||||
has_many :parties
|
has_many :parties, dependent: :destroy
|
||||||
|
|
||||||
##### ActiveRecord Validations
|
##### ActiveRecord Validations
|
||||||
validates :username,
|
validates :username,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue