<commit_before>module Fe
  class Person < ActiveRecord::Base
    belongs_to :user, :foreign_key => "fk_ssmUserId" # TODO need to migrate person columns to be more rails-like
    has_one    :current_address, -> { where("address_type = 'current'") }, :class_name => "Fe::Address"
    has_many   :email_addresses, :foreign_key => "person_id", :class_name => '::EmailAddress', dependent: :destroy
    has_many   :phone_numbers, :foreign_key => "person_id", :class_name => '::PhoneNumber', dependent: :destroy
    has_one    :current_address, -> { where("address_type = 'current'") }, :foreign_key => "person_id", :class_name => '::Fe::Address'
    has_one    :permanent_address, -> { where("address_type = 'permanent'") }, :foreign_key => "person_id", :class_name => '::Fe::Address'
    has_one    :emergency_address1, -> { where("address_type = 'emergency1'") }, :foreign_key => "person_id", :class_name => 'Fe::Address'
    has_many   :addresses, :foreign_key => "person_id", dependent: :destroy
    has_one    :application, :foreign_key => "applicant_id"

    def emergency_address
      emergency_address1
    end
    def emergency_address=(address)
      self.emergency_address1 = address
    end

    def create_emergency_address
      Address.create(:person_id => self.id, :address_type => 'emergency1')
    end

    def create_current_address
      Address.create(:person_id => self.id, :address_type => 'current')
    end

    def create_permanent_address
      Address.create(:person_id => self.id, :address_type => 'permanent')
    end
  end<commit_msg>add applications assocation in fe<commit_after>module Fe
  class Person < ActiveRecord::Base
    belongs_to :user, :foreign_key => "fk_ssmUserId" # TODO need to migrate person columns to be more rails-like
    has_one    :current_address, -> { where("address_type = 'current'") }, :class_name => "Fe::Address"
    has_many   :email_addresses, :foreign_key => "person_id", :class_name => '::EmailAddress', dependent: :destroy
    has_many   :phone_numbers, :foreign_key => "person_id", :class_name => '::PhoneNumber', dependent: :destroy
    has_one    :current_address, -> { where("address_type = 'current'") }, :foreign_key => "person_id", :class_name => '::Fe::Address'
    has_one    :permanent_address, -> { where("address_type = 'permanent'") }, :foreign_key => "person_id", :class_name => '::Fe::Address'
    has_one    :emergency_address1, -> { where("address_type = 'emergency1'") }, :foreign_key => "person_id", :class_name => 'Fe::Address'
    has_many   :addresses, :foreign_key => "person_id", dependent: :destroy
    has_many   :applications, class_name: Fe.answer_sheet_class

    def emergency_address
      emergency_address1
    end
    def emergency_address=(address)
      self.emergency_address1 = address
    end

    def create_emergency_address
      Address.create(:person_id => self.id, :address_type => 'emergency1')
    end

    def create_current_address
      Address.create(:person_id => self.id, :address_type => 'current')
    end

    def create_permanent_address
      Address.create(:person_id => self.id, :address_type => 'permanent')
    end
  end
{'fraction_non_alphanumeric': 0.13772264631043257, 'fraction_numerical': 0.0031806615776081423, 'mean_word_length': 4.3668941979522184, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, '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': '2190247', 'n_tokens_mistral': 1029, 'n_tokens_neox': 994, 'n_words': 215}