Manuel Bustillo
cc45b4c16e
All checks were successful
Run unit tests / unit_tests (pull_request) Successful in 1m35s
8 lines
249 B
Ruby
8 lines
249 B
Ruby
class Group < ApplicationRecord
|
|
validates :name, uniqueness: true
|
|
validates :name, :order, presence: true
|
|
|
|
has_many :children, class_name: 'Group', foreign_key: 'parent_id'
|
|
belongs_to :parent, class_name: 'Group', optional: true
|
|
end
|