class RulingTimerSection include Mongoid::Document include Mongoid::Timestamps field :section_name, type: String, default: "" belongs_to :ruling_timer_project has_many :ruling_timer_task field :task_count, type: Integer, default: 0 after_destroy do |record| RulingTimerTask.where(:ruling_timer_section_id=>record.id).update_all(:ruling_timer_section_id=>nil) end end