class Actuality < ActiveRecord::Base belongs_to :image_file validates :title, :presence => true has_one :block, :as => :blockable after_create do @block = Block.new(:block_name => "general") @block.blockable = self @block.save ContentType.all.each do |content_type| @block.content_types << content_type end end end