add WowGuild model

This commit is contained in:
2021-05-28 17:04:31 +02:00
parent 558cc52de9
commit f8c539bb87
7 changed files with 108 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ class WowCharacter < ApplicationRecord
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

12
app/models/wow_guild.rb Normal file
View File

@@ -0,0 +1,12 @@
# frozen_string_literal: true
class WowGuild < ApplicationRecord
extend Mobility
translates :translated_faction
belongs_to :wow_realm
has_many :wow_characters, dependent: :nullify
validates :name, presence: true
validates :guild_id, presence: true, uniqueness: true
end