mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-10 21:24:20 +01:00
17 lines
422 B
Ruby
17 lines
422 B
Ruby
# frozen_string_literal: true
|
|
|
|
# SlotsReservation is the relation table between a Slot and a Reservation.
|
|
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
|
|
return unless slot.destroying
|
|
|
|
slot.destroy
|
|
end
|
|
end
|