<commit_before>- has_many_asoc_names = has_many_association_names(f.object.class)
- f.object.class.reflect_on_all_associations(:has_many).each do |asoc|
  - next unless has_many_asoc_names.include?(asoc.name)

  - if @controller.has_template( "_edit.field.#{asoc.name}" )
    = render "edit.field.#{asoc.name}", :f => f
  - else

    - sortable_objects = asoc.klass.column_names.include?('position')

    -# TODO remove code duplication
    .nested_wrap
      .nested_title= I18n.t(asoc.name)
      .list{:"data-sortable" => sortable_objects ? '' : nil}
        - f.object.send(asoc.name).each_with_index do |asoc_obj,i|
          .item

            = f.fields_for asoc.name, asoc_obj, :child_index => i do |ff|
              - if sortable_objects
                = ff.hidden_field :position, :class => :position
                .handle &nbsp;
              - (asoc_obj.class.column_names - %w[id updated_at created_at position]).reject {|f| f =~ /_id$/ }.each do |field_name|
                = render 'edit.field', :name => field_name, :f => ff
              = render 'edit.field.type_delete_nested', :f => ff


      .template.item{:style => 'display:none;'}
        - asoc_obj = asoc.klass.new
        = f.fields_for asoc.name, asoc_obj, :child_index => :_template_ do |ff|
          - if sortable_objects
            = ff.hidden_field :position, :class => :position
            .handle &nbsp;
          - (asoc_obj.class.column_names - %w[id updated_at created_at position]).reject {|f| f =~ /_id$/ }.each do |field_name|
            = render 'edit.field', :name => field_name, :f => ff
          = render 'edit.field.type_delete_nested', :f => ff

      %button.add.new(type='button')
        = image_tag 'releaf/icons/add.png', :atl => ''
        %span New<commit_msg>Make it possible to override nested object fields<commit_after>- has_many_asoc_names = has_many_association_names(f.object.class)
- f.object.class.reflect_on_all_associations(:has_many).each do |asoc|
  - next unless has_many_asoc_names.include?(asoc.name)

  - if @controller.has_template( "_edit.field.#{asoc.name}" )
    = render "edit.field.#{asoc.name}", :f => f
  - else

    - sortable_objects = asoc.klass.column_names.include?('position')

    -# TODO remove code duplication
    .nested_wrap
      .nested_title= I18n.t(asoc.name)
      .list{:"data-sortable" => sortable_objects ? '' : nil}
        - f.object.send(asoc.name).each_with_index do |asoc_obj,i|
          .item

            = f.fields_for asoc.name, asoc_obj, :child_index => i do |ff|
              - if sortable_objects
                = ff.hidden_field :position, :class => :position
                .handle &nbsp;
              - (asoc_obj.class.column_names - %w[id updated_at created_at position]).reject {|f| f =~ /_id$/ }.each do |field_name|
                - if @controller.has_template( "_edit.field.#{asoc.name}.#{field_name}" )
                  = render "edit.field.#{asoc.name}.#{field_name}", :f => f
                - else
                  = render 'edit.field', :name => field_name, :f => ff
              = render 'edit.field.type_delete_nested', :f => ff


      .template.item{:style => 'display:none;'}
        - asoc_obj = asoc.klass.new
        = f.fields_for asoc.name, asoc_obj, :child_index => :_template_ do |ff|
          - if sortable_objects
            = ff.hidden_field :position, :class => :position
            .handle &nbsp;
          - (asoc_obj.class.column_names - %w[id updated_at created_at position]).reject {|f| f =~ /_id$/ }.each do |field_name|
            - if @controller.has_template( "_edit.field.#{asoc.name}.#{field_name}" )
              = render "edit.field.#{asoc.name}.#{field_name}", :f => f
            - else
              = render 'edit.field', :name => field_name, :f => ff
          = render 'edit.field.type_delete_nested', :f => ff

      %button.add.new(type='button')
        = image_tag 'releaf/icons/add.png', :atl => ''
        %span New
{'fraction_non_alphanumeric': 0.15022761760242792, 'fraction_numerical': 0.0010116337885685382, 'mean_word_length': 2.3745733788395906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, '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': '3745468', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1329, 'n_words': 252}