Orbit/app/models/layout.rb

14 lines
364 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 => /^[a-zA-Z-_]+$/
validates_uniqueness_of :name
end