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:
parent
4450202d8d
commit
c5c7cbeab9
2 changed files with 2 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
class Room < ActiveRecord::Base
|
class Room < ActiveRecord::Base
|
||||||
belongs_to :venue
|
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 }
|
has_paper_trail ignore: [:guid], meta: { conference_id: :conference_id }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ describe Room do
|
||||||
|
|
||||||
describe 'association' do
|
describe 'association' do
|
||||||
it { should belong_to(:venue) }
|
it { should belong_to(:venue) }
|
||||||
it { should have_many(:event_schedules).dependent(:nullify) }
|
it { should have_many(:event_schedules).dependent(:destroy) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'callback' do
|
describe 'callback' do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue