<commit_before>require 'digest/sha1'
class User < ActiveRecord::Base
  apply_simple_captcha :message => "image and text were different"
  # LoginAndPassword Authentication:
  acts_as_agent :activation => true

  # CAS Authentication::
  #
  #acts_as_agent :authentication => [:cas ],
  #              :cas_filter => {
  #                 :cas_base_url => "https://kimi.dit.upm.es/cas/"
  #              }

  validates_presence_of :email

  acts_as_container

  acts_as_taggable

  has_one :profile
  has_many :invitations, :foreign_key => :email

  attr_accessible :captcha, :captcha_key, :authenticate_with_captcha
  attr_accessible :email2, :email3 , :machine_ids
  attr_accessible :superuser, :disabled
  
  has_many :participants
  has_and_belongs_to_many :events 
  has_and_belongs_to_many :machines
  has_and_belongs_to_many :groups
  
   is_indexed :fields => ['login','email'],
:include => [{:class_name => 'Profile',:field => 'name',:as => 'profile_name'},
             {:class_name => 'Profile',:field => 'organization',:as => 'profile_organization'},
             {:class_name => 'Profile',:field => 'lastname',:as => 'profile_lastname'}],
:concatenate => [{:class_name => 'Tag',:field => 'name',:as => 'tags',
:association_sql => "LEFT OUTER JOIN taggings ON (users.`id` = taggings.`taggable_id` AND taggings.`taggable_type` = 'User') LEFT OUTER JOIN tags ON (tags.`id` = taggings.`tag_id`)"
}]

  after_create do |user|
    Invitation.find_all_by_email(user.email).map(&:to_performance)
  end
   
def name<commit_msg>Remove old invitations after_save code en User model<commit_after>require 'digest/sha1'
class User < ActiveRecord::Base
  apply_simple_captcha :message => "image and text were different"
  # LoginAndPassword Authentication:
  acts_as_agent :activation => true

  # CAS Authentication::
  #
  #acts_as_agent :authentication => [:cas ],
  #              :cas_filter => {
  #                 :cas_base_url => "https://kimi.dit.upm.es/cas/"
  #              }

  validates_presence_of :email

  acts_as_container

  acts_as_taggable

  has_one :profile
  has_many :invitations, :foreign_key => :email

  attr_accessible :captcha, :captcha_key, :authenticate_with_captcha
  attr_accessible :email2, :email3 , :machine_ids
  attr_accessible :superuser, :disabled
  
  has_many :participants
  has_and_belongs_to_many :events 
  has_and_belongs_to_many :machines
  has_and_belongs_to_many :groups
  
   is_indexed :fields => ['login','email'],
:include => [{:class_name => 'Profile',:field => 'name',:as => 'profile_name'},
             {:class_name => 'Profile',:field => 'organization',:as => 'profile_organization'},
             {:class_name => 'Profile',:field => 'lastname',:as => 'profile_lastname'}],
:concatenate => [{:class_name => 'Tag',:field => 'name',:as => 'tags',
:association_sql => "LEFT OUTER JOIN taggings ON (users.`id` = taggings.`taggable_id` AND taggings.`taggable_type` = 'User') LEFT OUTER JOIN tags ON (tags.`id` = taggings.`tag_id`)"
}]

def name
{'fraction_non_alphanumeric': 0.14180847514180847, 'fraction_numerical': 0.002002002002002002, 'mean_word_length': 4.2596491228070175, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 2, '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': '5959114', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1015, 'n_words': 201}