<commit_before>class Contact < MailForm::Base
  attribute :name,      :validate => true
  attribute :email,     :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
  attribute :restroom_id, :allow_blank => true
  attribute :restroom_name, :allow_blank => true
  validate :restroom_must_exist
  attribute :message
  attribute :nickname,  :captcha  => true

  def restroom_must_exist
    if restroom_id.present?
      if Restroom.where(:id => restroom_id, :name => restroom_name).blank?
        errors.add(:base, "Must be valid restroom ID and Name")
      end
    end
  end
  # Declare the e-mail headers. It accepts anything the mail method
  # in ActionMailer accepts.
  def headers
    {
      :subject => "My Contact Form #{restroom_id}",
      :to => "<EMAIL>",
      :from => %("#{name}" <#{email}>)
    }
  end
end<commit_msg>Restroom -> Home in contact.rb<commit_after>class Contact < MailForm::Base
  attribute :name,      :validate => true
  attribute :email,     :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
  attribute :home_id, :allow_blank => true
  attribute :home_name, :allow_blank => true
  validate :home_must_exist
  attribute :message
  attribute :nickname,  :captcha  => true

  def home_must_exist
    if home_id.present?
      if Home.where(:id => home_id, :name => home_name).blank?
        errors.add(:base, "Must be valid home ID and Name")
      end
    end
  end
  # Declare the e-mail headers. It accepts anything the mail method
  # in ActionMailer accepts.
  def headers
    {
      :subject => "My Contact Form #{home_id}",
      :to => "<EMAIL>",
      :from => %("#{name}" <#{email}>)
    }
  end
end
{'fraction_non_alphanumeric': 0.1603145795523291, 'fraction_numerical': 0.0012099213551119178, 'mean_word_length': 3.0048426150121066, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 28, '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': '2809308', 'n_tokens_mistral': 560, 'n_tokens_neox': 549, 'n_words': 150}