Nicolas Bally 1fa250e0e4 Initial
2011-07-15 12:29:09 +02:00

38 lines
662 B
Ruby

# -*- encoding : utf-8 -*-
class Page < ActiveRecord::Base
has_one :menu_item, :as => :menu_content
has_many :blocks, :as => :blockable, :dependent => :destroy
validates :title, :presence => true
HUMAN_NAME = "Page"
after_create :after_creation
def after_creation
@block = Block.new(:block_name => "body")
@block.blockable = self
@block.save
ContentType.all.each do |content_type|
@block.content_types << content_type
end
@block = Block.new(:block_name => "sidebar")
@block.blockable = self
@block.save
ContentType.all.each do |content_type|
@block.content_types << content_type
end
end
end