class DesktopApp include Mongoid::Document include Mongoid::Timestamps field :name field :author field :shape field :version, :type => String field :text_color, :type => String, default: "" field :bg_color, :type => String, default: "" field :icon, default: "icon.png" field :url has_many :images, as: :imgs, :autosave => true, :dependent => :destroy has_and_belongs_to_many :desktops, :autosave => true has_many :tiles, :autosave => true accepts_nested_attributes_for :images, :allow_destroy => true end