caxlsx / caxlsx_rails

A Rails plugin to provide templates for the axlsx gem
MIT License
735 stars 84 forks source link

Rails 6 API only [object Object] #138

Closed eduscrakozabrus closed 4 years ago

eduscrakozabrus commented 4 years ago

my routs: get 'conversations/export-excel', to: 'conversations#export_excel', defaults: { format: "xlsx" }

my controller: def export_excel @сonversations = Conversation.all respond_to do |format| format.xlsx end end my example axlsx: `p = Axlsx::Package.new wb = p.workbook

wb.add_worksheet(:name => "Basic Worksheet") do |sheet| sheet.add_row ["First Column", "Second", "Third"] sheet.add_row [1, 2, 3] sheet.add_row [' preserving whitespace'] end`

but have in file one value: [object Object]

straydogstudio commented 4 years ago

Rails in api mode does not include the template loading mechanism. It does not include ActionView. This is probably your issue. See this issue for suggestions: https://github.com/caxlsx/caxlsx_rails/issues/107

joelGarcia93 commented 2 years ago

@eduscrakozabrus how did you fix this? can you share important files to solve this issue? I'm trying but I can not get success.

straydogstudio commented 2 years ago

@joelGarcia93 Did you see Issue #107 listed above?