2012-04-03 10:25:41 +00:00
|
|
|
class Section
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
|
2012-04-05 12:32:56 +00:00
|
|
|
field :name
|
2012-04-03 10:25:41 +00:00
|
|
|
|
|
|
|
belongs_to :desktop
|
|
|
|
has_many :groups, :autosave => true, :dependent => :destroy
|
|
|
|
|
|
|
|
before_create :initialize_group
|
|
|
|
|
|
|
|
def initialize_group
|
2012-04-05 12:32:56 +00:00
|
|
|
self.groups.build
|
2012-04-03 10:25:41 +00:00
|
|
|
end
|
|
|
|
|
2012-12-04 09:45:40 +00:00
|
|
|
end
|