orbit-basic/app/models/desktop.rb

16 lines
302 B
Ruby

class Desktop
include Mongoid::Document
include Mongoid::Timestamps
field :theme, default: "default"
belongs_to :user
has_many :sections, :autosave => true, :dependent => :destroy
before_create :initialize_section
def initialize_section
user.self.build_section
end
end