programandoarg/pg_rails

View on GitHub
pg_scaffold/lib/generators/pg_slim/templates/download.xlsx.axlsx

Summary

Maintainability
Test Coverage
# frozen_string_literal: true

wb = xlsx_package.workbook
wb.add_worksheet(name: '<%= human_name %>') do |sheet|
  sheet.add_row [
    <%= attributes.map {|attribute| "@clase_modelo.human_attribute_name(:#{ attribute.name })" }.join(",\n    ") %>
  ]

  @<%= plural_name %>.decorate.each do |<%= singular_name %>|
    sheet.add_row [
      <%= attributes.map {|attribute| "#{ singular_name }.#{ attribute.name }" }.join(",\n      ") %>
    ]
  end
end