vol1ura/Sat_9am_5km

View on GitHub
app/models/country.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

class Country < ApplicationRecord
  has_many :clubs, dependent: :destroy
  has_many :events, dependent: :destroy
  has_many :activities, through: :events

  validates :code, presence: true, uniqueness: true

  def name
    I18n.t("country.#{code}")
  end

  def host
    "s95.#{code}"
  end
end