Files
site/app/models/wow_character.rb
2021-05-28 17:04:31 +02:00

22 lines
722 B
Ruby

# frozen_string_literal: true
class WowCharacter < ApplicationRecord
extend Mobility
translates :translated_faction, :translated_gender
belongs_to :user
belongs_to :wow_realm
belongs_to :wow_class
belongs_to :wow_race
belongs_to :wow_character_title, optional: true
belongs_to :wow_guild, optional: true
belongs_to :last_position, class_name: 'WowGeoPosition', optional: true
belongs_to :bind_position, class_name: 'WowGeoPosition', optional: true
has_one :wow_character_medium, dependent: :nullify
has_many :wow_standings, dependent: :nullify
has_many :wow_reputations, through: :wow_standings
validates :name, presence: true
validates :character_id, presence: true, uniqueness: true
end