Add dependent destroy and related test for deleting a user

This commit is contained in:
Gopesh Tulsyan 2014-07-17 17:45:40 +05:30
parent 64e191f60e
commit 9a1db8419c
3 changed files with 7 additions and 1 deletions

View file

@ -16,7 +16,7 @@ class User < ActiveRecord::Base
:name, :email_public, :biography, :nickname, :affiliation
has_many :event_users, dependent: :destroy
has_many :events, -> { uniq }, through: :event_users
has_many :events, -> { uniq }, through: :event_users, dependent: :destroy
has_many :registrations, dependent: :destroy
has_many :votes, dependent: :destroy
has_many :voted_events, through: :votes, source: :events