class Generators::Avo::ResourceGenerator

def generated_fields_template

def generated_fields_template
  return if fields.blank?
  fields_string = ""
  fields.each do |field_name, field_options|
    # if field_options are not available (likely a missing resource for an association), skip the field
    fields_string += "\n    # Could not generate a field for #{field_name}" and next unless field_options
    options = ""
    field_options[:options].each { |k, v| options += ", #{k}: #{v}" } if field_options[:options].present?
    fields_string += "\n    #{field_string field_name, field_options[:field], options}"
  end
  fields_string
end