This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
2012-04-03 10:25:41 +00:00
|
|
|
class Desktop
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
|
2013-07-25 09:18:24 +00:00
|
|
|
field :theme
|
2012-04-17 13:15:40 +00:00
|
|
|
field :customtheme
|
2012-04-18 14:01:12 +00:00
|
|
|
field :wallpaper
|
2012-04-03 10:25:41 +00:00
|
|
|
|
|
|
|
belongs_to :user
|
2012-11-05 15:04:54 +00:00
|
|
|
has_and_belongs_to_many :desktop_widgets, :autosave => true
|
2012-04-17 13:15:40 +00:00
|
|
|
|
2012-04-03 10:25:41 +00:00
|
|
|
has_many :sections, :autosave => true, :dependent => :destroy
|
2012-11-01 12:42:40 +00:00
|
|
|
# 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
|