<commit_before>require 'aasm'
require File.expand_path("../../validators/email_validator", __FILE__)

class ReferenceSheet < ActiveRecord::Base
  include AnswerSheetConcern
  include Rails.application.routes.url_helpers
  include AASM
  self.table_name = "#{Qe.table_name_prefix}references"
  self.inheritance_column = 'fake'

  belongs_to :question,
    :class_name => 'Element',
    :foreign_key => 'question_id'

  belongs_to :applicant_answer_sheet,
    :class_name => Qe.answer_sheet_class,
    :foreign_key => "applicant_answer_sheet_id"

  validates_presence_of :first_name, :last_name, :phone, :email, :relationship, :on => :update, :message => "can't be blank"
  validates :email, email: true

  delegate :style, :to => :question
<commit_msg>Only validate reference email on update<commit_after>require 'aasm'
require File.expand_path("../../validators/email_validator", __FILE__)

class ReferenceSheet < ActiveRecord::Base
  include AnswerSheetConcern
  include Rails.application.routes.url_helpers
  include AASM
  self.table_name = "#{Qe.table_name_prefix}references"
  self.inheritance_column = 'fake'

  belongs_to :question,
    :class_name => 'Element',
    :foreign_key => 'question_id'

  belongs_to :applicant_answer_sheet,
    :class_name => Qe.answer_sheet_class,
    :foreign_key => "applicant_answer_sheet_id"

  validates_presence_of :first_name, :last_name, :phone, :email, :relationship, :on => :update, :message => "can't be blank"
  validates :email, email: true, :on => :update

  delegate :style, :to => :question

{'fraction_non_alphanumeric': 0.1211139896373057, 'fraction_numerical': 0.0, 'mean_word_length': 5.410788381742739, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '2462663', 'n_tokens_mistral': 520, 'n_tokens_neox': 503, 'n_words': 107}