class Section
  include Mongoid::Document
  include Mongoid::Timestamps

  field :name
  field :sort, type: Integer, default: 0

  has_many :nodes, dependent: :destroy

  default_scope { desc(:sort) }

end

class Section
  include Mongoid::Document
  include Mongoid::Timestamps

  field :name
  field :sort, type: Integer, default: 0

  has_many :nodes, dependent: :destroy

  default_scope { desc(:sort) }

  validates :name, presence: true
  validates :name, uniqueness: true

end

Add custom validators to the name field when saving the scetion.
Add custom validators to the name field when saving the scetion.
