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.
orbit-4-1/app/models/desktop.rb

21 lines
470 B
Ruby

class Desktop
include Mongoid::Document
include Mongoid::Timestamps
field :theme, default: "default"
field :customtheme
belongs_to :user
has_many :sections, :autosave => true, :dependent => :destroy
before_create :initialize_section
def initialize_section
self.sections.build(name: "Desktop 1")
self.sections.build(name: "Desktop 2")
self.sections.build(name: "Desktop 3")
self.sections.build(name: "Desktop 4")
end
end