blob: b8c49f11ed5f907995d3221842e03fefeabbe1d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
class Category < ApplicationRecord
belongs_to :taxonomy
has_many :sections,
-> { order(rank: :asc) },
dependent: :destroy,
inverse_of: :category
acts_as_list column: :rank, scope: :taxonomy
validates :name,
presence: true,
uniqueness: { scope: :taxonomy_id },
length: 3..64
end
|