1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-15 00:24:09 +01:00
fab-manager/app/models/event_theme.rb

15 lines
286 B
Ruby

class EventTheme < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: :slugged
has_and_belongs_to_many :events, join_table: :events_event_themes, dependent: :destroy
def safe_destroy
if self.events.count == 0
destroy
else
false
end
end
end