32 lines
1 KiB
Ruby
32 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class WeaponSeries < ApplicationRecord
|
|
has_many :weapons, dependent: :restrict_with_error
|
|
has_many :weapon_key_series, dependent: :destroy
|
|
has_many :weapon_keys, through: :weapon_key_series
|
|
|
|
validates :name_en, presence: true
|
|
validates :name_jp, presence: true
|
|
validates :slug, presence: true, uniqueness: true
|
|
validates :order, numericality: { only_integer: true }
|
|
|
|
scope :ordered, -> { order(:order) }
|
|
scope :extra_allowed, -> { where(extra: true) }
|
|
scope :element_changeable, -> { where(element_changeable: true) }
|
|
scope :with_weapon_keys, -> { where(has_weapon_keys: true) }
|
|
scope :with_awakening, -> { where(has_awakening: true) }
|
|
scope :with_ax_skills, -> { where(has_ax_skills: true) }
|
|
|
|
# Slug constants for commonly referenced series
|
|
DARK_OPUS = 'dark-opus'
|
|
DRACONIC = 'draconic'
|
|
DRACONIC_PROVIDENCE = 'draconic-providence'
|
|
REVENANT = 'revenant'
|
|
ULTIMA = 'ultima'
|
|
SUPERLATIVE = 'superlative'
|
|
CLASS_CHAMPION = 'class-champion'
|
|
|
|
def blueprint
|
|
WeaponSeriesBlueprint
|
|
end
|
|
end
|