# encoding: utf-8 class Unit include Mongoid::Document include Mongoid::Timestamps include Slug field :name, as: :slug_title, :localize => true field :sort_number, type: Integer has_many :departments, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :departments, :allow_destroy => true end