21 lines
396 B
Ruby
21 lines
396 B
Ruby
class Layout < DesignFile
|
|
|
|
embedded_in :design
|
|
|
|
attr_reader :content
|
|
field :name, :index => true
|
|
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 content
|
|
self.file.read
|
|
end
|
|
def self.exist_one?
|
|
Layout.count > 0
|
|
end
|
|
end
|