<commit_before>=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by <NAME>
  Email: <EMAIL>
  This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the  GNU Affero General Public License (GPLv3) for more details.
=end
class UniqValidator < ActiveModel::Validator
  def validate(record)
    #record.errors[:base] << "#{I18n.t('admin.users.message.requires_different_name')}" if TermTaxonomy.where(name: record.name).where.not(id: record.id).where("term_taxonomy.taxonomy" => record.taxonomy).where("term_taxonomy.parent_id" => record.parent_id).size > 0
    record.errors[:base] << "#{I18n.t('admin.post.message.requires_different_slug')}" if TermTaxonomy.where(slug: record.slug).where.not(id: record.id).where("term_taxonomy.taxonomy" => record.taxonomy).where("term_taxonomy.parent_id" => record.parent_id).size > 0
  end
end
class TermTaxonomy < ActiveRecord::Base
  include Metas
  include CustomFieldsRead
  self.table_name = "term_taxonomy"
  attr_accessible :taxonomy, :description, :parent_id, :count, :name, :slug, :term_group, :status, :term_order

  # callbacks

  after_create :set_default_options
  before_validation :before_validating
  before_destroy :destroy_dependencies
  # validates<commit_msg>add attr_accessible user_id in term_taxonomy<commit_after>=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by <NAME>
  Email: <EMAIL>
  This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the  GNU Affero General Public License (GPLv3) for more details.
=end
class UniqValidator < ActiveModel::Validator
  def validate(record)
    #record.errors[:base] << "#{I18n.t('admin.users.message.requires_different_name')}" if TermTaxonomy.where(name: record.name).where.not(id: record.id).where("term_taxonomy.taxonomy" => record.taxonomy).where("term_taxonomy.parent_id" => record.parent_id).size > 0
    record.errors[:base] << "#{I18n.t('admin.post.message.requires_different_slug')}" if TermTaxonomy.where(slug: record.slug).where.not(id: record.id).where("term_taxonomy.taxonomy" => record.taxonomy).where("term_taxonomy.parent_id" => record.parent_id).size > 0
  end
end
class TermTaxonomy < ActiveRecord::Base
  include Metas
  include CustomFieldsRead
  self.table_name = "term_taxonomy"
  attr_accessible :taxonomy, :description, :parent_id, :count, :name, :slug, :term_group, :status, :term_order, :user_id

  # callbacks

  after_create :set_default_options
  before_validation :before_validating
  before_destroy :destroy_dependencies
  # validates
{'fraction_non_alphanumeric': 0.0979020979020979, 'fraction_numerical': 0.007297050775311645, 'mean_word_length': 5.450980392156863, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6482079', 'n_tokens_mistral': 994, 'n_tokens_neox': 970, 'n_words': 304}