Delete EventSchedules when a Room is deleted

We should remove all the EventSchedules that belongs_to a Room when it is deleted. Otherwise both the public and admin schedule would fail.
This commit is contained in:
Ana 2016-08-18 14:08:53 +02:00
parent 4450202d8d
commit c5c7cbeab9
2 changed files with 2 additions and 2 deletions

View file

@ -1,6 +1,6 @@
class Room < ActiveRecord::Base
belongs_to :venue
has_many :event_schedules, dependent: :nullify
has_many :event_schedules, dependent: :destroy
has_paper_trail ignore: [:guid], meta: { conference_id: :conference_id }

View file

@ -11,7 +11,7 @@ describe Room do
describe 'association' do
it { should belong_to(:venue) }
it { should have_many(:event_schedules).dependent(:nullify) }
it { should have_many(:event_schedules).dependent(:destroy) }
end
describe 'callback' do