Tidy model 'dependent: destroy' options
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
class Account < ApplicationRecord
|
||||
has_many :users
|
||||
has_many :users, dependent: :destroy
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Category < ApplicationRecord
|
||||
has_many :categorizations
|
||||
has_many :splats, through: :categorizations, dependent: :destroy
|
||||
has_many :categorizations, dependent: :destroy
|
||||
has_many :splats, through: :categorizations
|
||||
end
|
||||
|
||||
+4
-3
@@ -1,13 +1,14 @@
|
||||
class Splat < ApplicationRecord
|
||||
belongs_to :creator, class_name: "User", default: -> { Current.user }
|
||||
|
||||
has_many :comments, dependent: :destroy
|
||||
has_many :boosts, dependent: :destroy
|
||||
|
||||
has_many :categorizations
|
||||
has_many :categories, through: :categorizations, dependent: :destroy
|
||||
has_many :comments, dependent: :destroy
|
||||
|
||||
has_one_attached :image, dependent: :purge_later
|
||||
|
||||
belongs_to :creator, class_name: "User", default: -> { Current.user }
|
||||
|
||||
enum :color, %w[
|
||||
#AF2E1B #CC6324 #3B4B59 #BFA07A #ED8008 #ED3F1C #BF1B1B #736B1E #D07B53
|
||||
#736356 #AD1D1D #BF7C2A #C09C6F #698F9C #7C956B #5D618F #3B3633 #67695E
|
||||
|
||||
@@ -4,8 +4,6 @@ class User < ApplicationRecord
|
||||
has_many :sessions, dependent: :destroy
|
||||
has_secure_password validations: false
|
||||
|
||||
has_many :splats, dependent: :destroy
|
||||
|
||||
normalizes :email_address, with: ->(value) { value.strip.downcase }
|
||||
|
||||
def initials
|
||||
|
||||
Reference in New Issue
Block a user