orbit-basic/app/models/desktop.rb

23 lines
577 B
Ruby
Raw Normal View History

2012-04-03 10:25:41 +00:00
class Desktop
include Mongoid::Document
include Mongoid::Timestamps
field :theme, default: "4f8d3f493b67fcd05f086359"
field :customtheme
field :wallpaper
2012-04-03 10:25:41 +00:00
belongs_to :user
2012-04-03 10:25:41 +00:00
has_many :sections, :autosave => true, :dependent => :destroy
has_many :desktop_widgets, :autosave => true, :dependent => :destroy
2012-04-03 10:25:41 +00:00
before_create :initialize_section
def initialize_section
2012-04-05 12:32:56 +00:00
self.sections.build(name: "Desktop 1")
self.sections.build(name: "Desktop 2")
self.sections.build(name: "Desktop 3")
self.sections.build(name: "Desktop 4")
2012-04-03 10:25:41 +00:00
end
end