add creature and base rp_world
This commit is contained in:
9
app/models/rp_world.rb
Normal file
9
app/models/rp_world.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class RpWorld < ApplicationRecord
|
||||
belongs_to :user
|
||||
alias_attribute :owner, :user
|
||||
has_many :wow_character_play_rp_worlds, dependent: :destroy
|
||||
has_many :wow_characters, through: :wow_character_play_rp_worlds
|
||||
alias_attribute :members, :wow_characters
|
||||
|
||||
validates :name, presence: true
|
||||
end
|
||||
@@ -17,6 +17,8 @@ class WowCharacter < ApplicationRecord
|
||||
has_one :wow_character_medium, dependent: :destroy
|
||||
has_many :wow_standings, dependent: :destroy
|
||||
has_many :wow_reputations, through: :wow_standings
|
||||
has_many :wow_character_play_rp_worlds, dependent: :destroy
|
||||
has_many :rp_worlds, through: :wow_character_play_rp_worlds
|
||||
|
||||
validates :name, presence: true
|
||||
validates :character_id, presence: true, uniqueness: true
|
||||
|
||||
7
app/models/wow_character_play_rp_world.rb
Normal file
7
app/models/wow_character_play_rp_world.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class WowCharacterPlayRpWorld < ApplicationRecord
|
||||
belongs_to :wow_character
|
||||
belongs_to :rp_world
|
||||
|
||||
validates :status, presence: true, format: { with: /(INVITED|PENDING|PLAYING|BANNED)/ }
|
||||
validates :role, presence: true, format: { with: /(PLAYER|MODERATOR|ADMIN)/ }
|
||||
end
|
||||
10
app/models/wow_creature.rb
Normal file
10
app/models/wow_creature.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class WowCreature < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
belongs_to :wow_creature_family, optional: true
|
||||
belongs_to :wow_creature_type, optional: true
|
||||
|
||||
validates :name, presence: true
|
||||
validates :creature_id, presence: true, uniqueness: true
|
||||
end
|
||||
9
app/models/wow_creature_family.rb
Normal file
9
app/models/wow_creature_family.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class WowCreatureFamily < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
has_many :wow_creatures, dependent: :destroy
|
||||
|
||||
validates :name, presence: true
|
||||
validates :creature_family_id, presence: true, uniqueness: true
|
||||
end
|
||||
9
app/models/wow_creature_type.rb
Normal file
9
app/models/wow_creature_type.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class WowCreatureType < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
has_many :wow_creatures, dependent: :destroy
|
||||
|
||||
validates :name, presence: true
|
||||
validates :creature_type_id, presence: true, uniqueness: true
|
||||
end
|
||||
Reference in New Issue
Block a user