diff --git a/app/models/question.rb b/app/models/question.rb index 740d59d6..aed4ec91 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -1,6 +1,7 @@ class Question < ActiveRecord::Base belongs_to :user has_many :answers + has_many :inboxes, dependent: :destroy validates :content, length: { maximum: 255 } diff --git a/app/models/user.rb b/app/models/user.rb index 45b3626a..258d9c44 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,9 +19,9 @@ class User < ActiveRecord::Base dependent: :destroy has_many :friends, through: :active_relationships, source: :target has_many :followers, through: :passive_relationships, source: :source - has_many :smiles - has_many :services - has_many :notifications, foreign_key: :recipient_id + has_many :smiles, dependent: :destroy + has_many :services, dependent: :destroy + has_many :notifications, foreign_key: :recipient_id, dependent: :destroy SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]{1,16}\z/ WEBSITE_REGEX = /https?:\/\/([A-Za-z.\-]+)\/?(?:.*)/i