2011-08-08 01:30:44 +00:00
|
|
|
class Layout < DesignFile
|
2010-01-04 07:52:30 +00:00
|
|
|
|
2011-08-08 01:30:44 +00:00
|
|
|
embedded_in :design
|
2011-05-18 02:00:00 +00:00
|
|
|
|
|
|
|
|
2011-08-08 01:30:44 +00:00
|
|
|
field :name, :index => true
|
2011-05-18 02:00:00 +00:00
|
|
|
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
|
2011-03-08 09:25:46 +00:00
|
|
|
end
|