<commit_before>class SimpleForm::FormBuilder
  def link_to_add(name, association)
    @fields ||= {}
    @template.after_nested_form(association) do
      model_object = object.class.reflect_on_association(association).klass.new
      output = %Q[<div id="#{association}_fields_blueprint" style="display: none">].html_safe
      output << fields_for(association, model_object, :child_index => "new_#{association}", &@fields[association])
      output.safe_concat('</div>')
      output
    end
    @template.link_to(name, "javascript:void(0)", :class => "add_nested_fields", "data-association" => association)
  end
  
  def link_to_remove(name)
    hidden_field(:_destroy) + @template.link_to(name, "javascript:void(0)", :class => "remove_nested_fields")
  end
  
  
  def fields_for_with_nested_attributes(association, args, block)
    @fields ||= {}
    @fields[association] = block
    super
  end

  
  def fields_for_nested_model(name, association, args, block = nil)
    output = '<div class="fields">'.html_safe
    if block.nil?<commit_msg>added support for removing duplicates if only the first occurrence of a field should be displayed<commit_after>class SimpleForm::FormBuilder
  def link_to_add(name, association, html_options = {})
    html_options.merge!(:class => "add_nested_fields", "data-association" => association)
    @fields ||= {}
    @template.after_nested_form(association) do
      model_object = object.class.reflect_on_association(association).klass.new
      output = %Q[<div id="#{association}_fields_blueprint" style="display: none">].html_safe
      output << fields_for(association, model_object, :child_index => "new_#{association}", &@fields[association])
      output.safe_concat('</div>')
      output
    end
    @template.link_to(name, "javascript:void(0)", html_options)
  end
  
  def link_to_remove(name)
    hidden_field(:_destroy) + @template.link_to(name, "javascript:void(0)", :class => "remove_nested_fields")
  end
  
  
  def fields_for_with_nested_attributes(association, args, block)
    @fields ||= {}
    @fields[association] = block
    super
  end

  
  def fields_for_nested_model(name, association, args, block = nil)
    console.log(association)
    output = '<div class="fields">'.html_safe
    if block.nil?
{'fraction_non_alphanumeric': 0.1318342151675485, 'fraction_numerical': 0.001763668430335097, 'mean_word_length': 4.7153652392947105, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, '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': '328186', 'n_tokens_mistral': 719, 'n_tokens_neox': 720, 'n_words': 135}