2009-05-07 17:18:16 +00:00
|
|
|
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
|
2009-05-07 17:18:16 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2009-05-07 17:18:16 +00:00
|
|
|
end
|