<commit_before>class MeansOfInfluence < ApplicationRecord
  def self.types
    %w(Meeting Hospitality Gift Travel)
  end
  validates :month,:year,presence: true
  has_many :influence_government_office_people
  has_many :influence_organisation_people
  has_many :organisations,through: :influence_organisation_people
  has_many :organisation_people,through: :influence_organisation_people,source: 'person'
  has_many :government_people,through: :influence_government_office_people,source: 'person'
  has_many :government_offices,through: :influence_government_office_people

  self.types.each do |klass|
    scope klass.underscore.downcase.pluralize.to_sym,->{where(type: klass)}
  end
end<commit_msg>rails: fix API calls which include non-person relationships<commit_after>class MeansOfInfluence < ApplicationRecord
  def self.types
    %w(Meeting Hospitality Gift Travel)
  end
  validates :month,:year,presence: true
  has_many :influence_government_office_people
  has_many :influence_organisation_people
  has_many :organisations,through: :influence_organisation_people, source: 'organisation'
  has_many :organisation_people,through: :influence_organisation_people,source: 'person'
  has_many :government_people,through: :influence_government_office_people,source: 'person'
  has_many :government_offices,through: :influence_government_office_people, source: 'government_office'

  self.types.each do |klass|
    scope klass.underscore.downcase.pluralize.to_sym,->{where(type: klass)}
  end
end
{'fraction_non_alphanumeric': 0.0800533689126084, 'fraction_numerical': 0.0, 'mean_word_length': 7.875739644970414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2268862', 'n_tokens_mistral': 501, 'n_tokens_neox': 463, 'n_words': 88}