<commit_before>class User < ActiveRecord::Base
  has_secure_password
  belongs_to :profile
  belongs_to :person

  validates :email,
    presence: { presence: true, message: "Email obrigatório" },
    uniqueness: { uniqueness: true, message: "Email já existe" },
    format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }

  def register_to event
    "registrando em #{event.name}"
  end

  # Returns true if user's profile is admin.
  def is_admin?
    self.profile.key == Profile::ADMIN
  end

  # Returns true if user's profile is common user.
  def is_user?
    self.profile.key == Profile::USER
  end

  # Returns true if user's profile is ward leader.
  def is_ward_leader?
    self.profile.key == Profile::WARD_LEADER
  end

  # Returns true if user's profile is stake leader.
  def is_stake_leader?
    self.profile.key == Profile::STAKE_LEADER
  end
<commit_msg>[modify] user's validations and added append_errors method<commit_after>class User < ActiveRecord::Base
  has_secure_password
  belongs_to :profile
  belongs_to :person

  validates :email,
    presence: { presence: true, message: "obrigatório" },
    uniqueness: { uniqueness: true, message: "já existe" },
    format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }

  def register_to event
    "registrando em #{event.name}"
  end

  # Appends the array params to user's errors
  def append_errors array
    array.each do |key, value|
      self.errors[key] = value
    end
  end

  # Returns true if user's profile is admin.
  def is_admin?
    self.profile.key == Profile::ADMIN
  end

  # Returns true if user's profile is common user.
  def is_user?
    self.profile.key == Profile::USER
  end

  # Returns true if user's profile is ward leader.
  def is_ward_leader?
    self.profile.key == Profile::WARD_LEADER
  end

  # Returns true if user's profile is stake leader.
  def is_stake_leader?
    self.profile.key == Profile::STAKE_LEADER
  end

{'fraction_non_alphanumeric': 0.12203913491246138, 'fraction_numerical': 0.003089598352214212, 'mean_word_length': 3.3959276018099547, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4288391', 'n_tokens_mistral': 680, 'n_tokens_neox': 657, 'n_words': 190}