30 lines
630 B
Ruby
Executable File
30 lines
630 B
Ruby
Executable File
# -*- encoding : utf-8 -*-
|
|
|
|
class Newsletter < ActiveRecord::Base
|
|
validates_presence_of :title
|
|
|
|
has_one :block, :as => :blockable
|
|
after_create :after_creation
|
|
|
|
def after_creation
|
|
@block = Block.new(:block_name => "Contenu")
|
|
@block.blockable = self
|
|
@block.save
|
|
|
|
|
|
end
|
|
|
|
def alloweds_types
|
|
self.block.allow_types :TitleContent, :TextContent, :ImageContent, :LinkContent, :GalleryContent, :HtmlContent, :DownloadContent
|
|
|
|
end
|
|
|
|
|
|
#attr_accessible :title, :content, :email_from
|
|
|
|
#EMAIL_FROMS=["Le Pic Vert <contact@lepicvert.asso.fr>", "Le Pic Vert <s.montchalin@lepicvert.asso.fr>"]
|
|
|
|
|
|
|
|
end
|