<commit_before><commit_msg>Bugfix for rails ticket 6306: concerning association.build for sti models<commit_after># Bugfix: building an sti model from an association fails
# https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6306-collection-associations-build-method-not-supported-for-sti
ActiveRecord::Reflection::AssociationReflection.class_eval do
  def build_association(*opts)
    col = klass.inheritance_column.to_sym
    if !col.nil? && opts.first.is_a?(Hash) && (opts.first.symbolize_keys[col])
      sti_model = opts.first.delete(col)
      sti_model.to_s.constantize.new(*opts)
    else
      klass.new(*opts)
    end
  end
end
{'fraction_non_alphanumeric': 0.11467889908256881, 'fraction_numerical': 0.01834862385321101, 'mean_word_length': 4.695652173913044, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '5099730', 'n_tokens_mistral': 225, 'n_tokens_neox': 210, 'n_words': 38}