18 lines
321 B
Ruby
18 lines
321 B
Ruby
class Newsletter < ActiveRecord::Base
|
|
after_create :after_creation
|
|
has_one :block, :as => :blockable
|
|
|
|
def after_creation
|
|
@block = Block.new(:block_name => "Contenu")
|
|
@block.blockable = self
|
|
@block.save
|
|
|
|
ContentType.all.each do |content_type|
|
|
@block.content_types << content_type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|