17 lines
274 B
Ruby
17 lines
274 B
Ruby
|
class Section
|
||
|
include Mongoid::Document
|
||
|
include Mongoid::Timestamps
|
||
|
|
||
|
field :name
|
||
|
|
||
|
belongs_to :desktop
|
||
|
has_many :groups, :autosave => true, :dependent => :destroy
|
||
|
|
||
|
before_create :initialize_group
|
||
|
|
||
|
def initialize_group
|
||
|
self.groups.build
|
||
|
end
|
||
|
|
||
|
end
|