orbit-basic/app/models/page.rb

23 lines
468 B
Ruby

class Page < CouchFoo::Base
property :name, String
property :parent_name, String
property :content, String
property :layout_id, String
property :layout_name, String
belongs_to :layout
validates_presence_of :name
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