28 lines
509 B
Ruby
28 lines
509 B
Ruby
class PlumeArticle < ActiveRecord::Base
|
|
belongs_to :plume_cat
|
|
has_one :plume, :through => :plume_cat
|
|
belongs_to :image_file
|
|
|
|
has_one :block, :as => :blockable
|
|
before_validation do
|
|
|
|
end
|
|
|
|
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
|
|
|
|
end
|
|
|
|
end
|