class Popup < ActiveRecord::Base
  belongs_to :lang_site
  
  has_many :blocks, :as => :blockable
  
  
  has_many :popup_popupables
  
  has_many :popupables, :through => :popup_popupables
  
  after_create do
      
    LangSite.all.each do |lang|
      @block = Block.new(:block_name => "general", :lang_site => lang)
      @block.blockable = self
      @block.save
      
    end
  
  end
  
  def session_id
    self.id.to_s+"_"+self.version_id.to_s
  end
  
end
