1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-30 11:24:21 +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