mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-10 21:24:20 +01:00
15 lines
286 B
Ruby
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
|