<commit_before>class User < ActiveRecord::Base
  include StandardModelExtensions
  include Rails.application.routes.url_helpers
  include CaptchaExtensions
  include DeletedItemExtensions

  # Obfuscate domains to avoid this file showing up on GitHub in web searches for said domains
  EMAIL_DOMAIN_BLACKLIST = [
    'ivi' + 'zx.com',
  ]

  acts_as_authentic do |c|
    c.crypto_provider = Authlogic::CryptoProviders::Sha512
  end

  has_and_belongs_to_many :roles
  has_and_belongs_to_many :user_collections
  has_and_belongs_to_many :institutions 
  has_many :collections, :foreign_key => "user_id", :class_name => "UserCollection"
  has_many :permission_assignments, :dependent => :destroy
  has_many :responses

  has_many :cases, :dependent => :destroy
  has_many :text_blocks, :dependent => :destroy
  has_many :collages, :dependent => :destroy
  has_many :defaults, :dependent => :destroy
  has_many :medias, :dependent => :destroy
  has_many :case_requests, :dependent => :destroy
  has_many :playlists, :dependent => :destroy
  alias :textblocks :text_blocks

  def user_responses
    content = self.collages.includes(:responses) + self.text_blocks.includes(:responses)
    content.map(&:responses).flatten
  end

  # Deal with this later by replacing habtm with hm through
  def users_roles
    []
  end
  def users_user_collections
    []
  end
  def users_institutions
    []
  end

  attr_accessor :terms

  validates_format_of :email_address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})\Z/i, :allow_blank => true
  validates_inclusion_of :tz_name, :in => ActiveSupport::TimeZone::MAPPING.keys, :allow_blank => true
  validate :terms_validation
  validate :allowed_email_domain<commit_msg>Fix bug preventing user collages from being destroyed properly<commit_after>class User < ActiveRecord::Base
  include StandardModelExtensions
  include Rails.application.routes.url_helpers
  include CaptchaExtensions
  include DeletedItemExtensions

  # Obfuscate domains to avoid this file showing up on GitHub in web searches for said domains
  EMAIL_DOMAIN_BLACKLIST = [
    'ivi' + 'zx.com',
  ]

  acts_as_authentic do |c|
    c.crypto_provider = Authlogic::CryptoProviders::Sha512
  end

  has_and_belongs_to_many :roles
  has_and_belongs_to_many :user_collections
  has_and_belongs_to_many :institutions 
  has_many :collections, :foreign_key => "user_id", :class_name => "UserCollection"
  has_many :permission_assignments, :dependent => :destroy
  has_many :responses

  has_many :collages, :dependent => :destroy  #must precede all annotated item associations
  has_many :cases, :dependent => :destroy
  has_many :text_blocks, :dependent => :destroy
  has_many :defaults, :dependent => :destroy
  has_many :medias, :dependent => :destroy
  has_many :case_requests, :dependent => :destroy
  has_many :playlists, :dependent => :destroy
  alias :textblocks :text_blocks

  def user_responses
    content = self.collages.includes(:responses) + self.text_blocks.includes(:responses)
    content.map(&:responses).flatten
  end

  # Deal with this later by replacing habtm with hm through
  def users_roles
    []
  end
  def users_user_collections
    []
  end
  def users_institutions
    []
  end

  attr_accessor :terms

  validates_format_of :email_address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})\Z/i, :allow_blank => true
  validates_inclusion_of :tz_name, :in => ActiveSupport::TimeZone::MAPPING.keys, :allow_blank => true
  validate :terms_validation
  validate :allowed_email_domain
{'fraction_non_alphanumeric': 0.10216277746158224, 'fraction_numerical': 0.003414911781445646, 'mean_word_length': 4.9375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '2595566', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1134, 'n_words': 271}