22 lines
400 B
Ruby
22 lines
400 B
Ruby
class Layout
|
|
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
field :name, :index => true
|
|
field :description
|
|
field :content
|
|
|
|
references_many :children, :class_name => "Item"
|
|
has_many :layout_parts
|
|
|
|
validates_presence_of :name
|
|
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
|
|
validates_uniqueness_of :name
|
|
|
|
def self.exist_one?
|
|
Layout.count > 0
|
|
end
|
|
|
|
end
|