1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-11 00:52:29 +01:00
fab-manager/app/models/slots_reservation.rb
Sylvain 0e94f8c3d4 Redo "change DB model to allow many_to_many relationship between Slot and Reservation"
This reverts commit 4cbfbdc4e0f9a271d0fe13459a7b0f93de2c013a.
2017-02-28 13:23:31 +01:00

14 lines
319 B
Ruby

class SlotsReservation < ActiveRecord::Base
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