<commit_before>module Organisations
  extend ActiveSupport::Concern

  included do
    has_many :organisationables, as: :organisationable
  end

  def organisation_ids
    organisationables.any? ? organisationables.map(&:organisation_id) : []
  end

  def organisations
    organisation_ids.map { |organisation_id| Organisation.find organisation_id }
  end

  def joined_organisation_ids
    organisation_ids.join ", "
  end
  def joined_organisation_ids=(ids)
    organisationables.destroy_all
    ids.split(",").each do |oid|
      Organisationable.find_or_create_by!(organisationable: self, organisation_id: oid)
    end
  end
end<commit_msg>refactor module to accept #organisation_ids= on models that include it<commit_after>module Organisations
  extend ActiveSupport::Concern

  included do
    has_many :organisationables, as: :organisationable
  end

  def organisation_ids
    organisationables.any? ? organisationables.map(&:organisation_id) : []
  end

  def organisations
    organisation_ids.map { |organisation_id| Organisation.find organisation_id }
  end

  def organisation_ids=(ids)
    organisationables.destroy_all
    ids.reject(&:blank?).each do |oid|
      Organisationable.find_or_create_by!(organisationable: self, organisation_id: oid)
    end
  end
end
{'fraction_non_alphanumeric': 0.0766223612197029, 'fraction_numerical': 0.0, 'mean_word_length': 4.688888888888889, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1992098', 'n_tokens_mistral': 385, 'n_tokens_neox': 377, 'n_words': 84}