class LangArticle < ActiveRecord::Base
  
  belongs_to :lang_site
  belongs_to :article
  
	validates :title, :presence => true, :uniqueness => {scope: :lang_site_id}
	validates :slug, :presence => true, :uniqueness => {scope: :lang_site_id}
  
  
	before_validation do
		self.slug = self.title.to_slug
		#self.tags_cache = self.tags_cache.gsub(/ +/, ' ').gsub(/, /,',').gsub(/ ,/,',').gsub(/,+/, ',')
    #self.tags_cache = self.tags_cache.to_s.gsub(/ +/, ' ').gsub(/, /,',').gsub(/ ,/,',').gsub(/,+/, ',')
		
	end
end
