Files
puzzle-scoreboard/app/models/event.rb
sto 4a4c79ad8a
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Events: kickstart shared scoreboard
2026-07-30 08:33:55 +02:00

33 lines
785 B
Ruby

# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# lang :string default("en")
# name :string
# shared_scoreboard :boolean
# slug :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer not null
#
# Indexes
#
# index_events_on_user_id (user_id)
#
# Foreign Keys
#
# user_id (user_id => users.id)
#
class Event < ApplicationRecord
extend FriendlyId
belongs_to :user
has_many :contests, dependent: :destroy
friendly_id :name, use: :slugged
validates :name, presence: true
validates :lang, inclusion: { in: Languages::AVAILABLE_LANGUAGES.map { |lang| lang[:id] } }
end