improve achievement management and and views

This commit is contained in:
2021-08-24 20:53:32 +02:00
parent 39ebeea387
commit 2be44a89b8
18 changed files with 197 additions and 8 deletions

View File

@@ -4,8 +4,16 @@ class WowAchievementCategory < ApplicationRecord
extend Mobility
translates :name
belongs_to :parent_category, class_name: 'WowAchievementCategory', optional: true
has_many :child_categories,
class_name: 'WowAchievementCategory',
foreign_key: 'parent_category_id',
dependent: :nullify,
inverse_of: :parent_category
has_many :wow_achievements, dependent: :destroy
validates :name, presence: true
validates :category_id, presence: true, uniqueness: true
scope :base_categories, -> { where(parent_category: nil) }
end