mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
14 lines
318 B
Ruby
14 lines
318 B
Ruby
class SlotsReservation < ApplicationRecord
|
|
belongs_to :slot
|
|
belongs_to :reservation
|
|
after_destroy :cleanup_slots
|
|
|
|
# when the SlotsReservation is deleted (from Reservation destroy cascade), we delete the
|
|
# corresponding slot
|
|
def cleanup_slots
|
|
unless slot.destroying
|
|
slot.destroy
|
|
end
|
|
end
|
|
end
|