orbit-basic/app/models/page.rb

23 lines
468 B
Ruby
Raw Normal View History

class Page < CouchFoo::Base
property :name, String
property :parent_name, String
property :content, String
2009-05-07 17:54:33 +00:00
property :layout_id, String
property :layout_name, String
belongs_to :layout
validates_presence_of :name
2009-05-07 17:54:33 +00:00
before_save :setup_layout_id
def setup_layout_id
if self.layout_name.blank?
self.layout_id = nil
else
self.layout_id = Layout.find_by_name( self.layout_name ).id
end
end
end