orbit-basic/app/models/layout.rb

14 lines
368 B
Ruby

class Layout
include MongoMapper::Document
key :name, String, :required => true, :index => true
key :description, String
key_i18n :content, String
many :children, :class_name => "Item", :foreign_key => "layout_id", :dependent => :nullify
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
validates_uniqueness_of :name
end