improve achievement management and and views
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user