lib/active_admin/reform/form_builder.rb
def js_for_has_many(assoc, form_block, template, new_record, class_string)
        assoc_reflection = object.class.reflect_on_association assoc
        assoc_name       = assoc_reflection.klass.model_name
        placeholder      = "NEW_#{assoc_name.to_s.underscore.upcase.gsub(%r{/}, '_')}_RECORD"
        opts = {
          for: [assoc, nested_object(assoc)],
          class: class_string,
          for_options: { child_index: placeholder },
        }
        html = template.capture { inputs_for_nested_attributes opts, &form_block }
        text = new_record.is_a?(String) ? new_record : I18n.t('active_admin.has_many_new', model: assoc_name.human)

        template.link_to text, '#', class: 'button has_many_add', data: {
          html: CGI.escapeHTML(html).html_safe, placeholder: placeholder
        }
      end
# Capture the ADD JS
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
Capture the ADD JS
rubocop:disable Metrics/MethodLength, Metrics/AbcSize
Capture the ADD JS rubocop : disable Metrics / MethodLength Metrics / AbcSize
def js_for_has_many(assoc, form_block, template, new_record, class_string)
        assoc_reflection = object.class.reflect_on_association assoc
        assoc_name       = assoc_reflection.klass.model_name
        placeholder      = "NEW_#{assoc_name.to_s.underscore.upcase.gsub(%r{/}, '_')}_RECORD"
        opts = {
          for: [assoc, nested_object(assoc)],
          class: class_string,
          for_options: { child_index: placeholder },
        }
        html = template.capture { inputs_for_nested_attributes opts, &form_block }
        text = new_record.is_a?(String) ? new_record : I18n.t('active_admin.has_many_new', model: assoc_name.human)
        template.link_to text, '#', class: 'button has_many_add', data: {
          html: CGI.escapeHTML(html).html_safe, placeholder: placeholder
        }
      end
def js_for_has_many ( assoc , form_block , template , new_record , class_string ) assoc_reflection = object . class . reflect_on_association assoc assoc_name = assoc_reflection . klass . model_name placeholder = "NEW_#{assoc_name.to_s.underscore.upcase.gsub(%r{/}, '_')}_RECORD" opts = { for : [ assoc , nested_object ( assoc ) ] , class : class_string , for_options : { child_index : placeholder } , } html = template . capture { inputs_for_nested_attributes opts , & form_block } text = new_record . is_a? ( String ) ? new_record : I18n . t ( 'active_admin.has_many_new' , model : assoc_name . human ) template . link_to text , '#' , class : 'button has_many_add' , data : { html : CGI . escapeHTML ( html ) . html_safe , placeholder : placeholder } end
Capture the ADD JS
rubocop:disable Metrics/MethodLength, Metrics/AbcSize
Capture the ADD JS rubocop : disable Metrics / MethodLength Metrics / AbcSize
assoc
form_block
template
new_record
class_string