1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/models/event_theme.rb

18 lines
374 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# EventTheme is an optional filter used to categorize Events
2020-03-25 10:16:47 +01:00
class EventTheme < ApplicationRecord
extend FriendlyId
friendly_id :name, use: :slugged
has_and_belongs_to_many :events, join_table: 'events_event_themes', dependent: :destroy
def safe_destroy
if events.count.zero?
destroy
else
false
end
end
2016-06-28 15:56:37 +02:00
end