```ruby
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
```

Add custom validators to the name field when saving the scetion.
user
```ruby
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
```
assistant