Closed medinarodel closed 4 years ago
I have a mailer which has the functionality to email with excel attached. It is working fine.
ActionController::Base.new.render_to_string layout: false, handlers: [:axlsx], formats: [:xlsx], template: ie.template_path, locals: ie.locals
However, on the controller to download same excel file, it is not working, it is not calling my view/template (I've added pry on my view(.xlsx.axlsx))
render xlsx: ie.filename, handlers: [:axlsx], formats: [:xlsx], template: ie.template_path, locals: ie.locals
They are using same service ie = MyService.new(...)
ie = MyService.new(...)
It is not throwing any errors. Shows prompt the download, and if you download the file, it cannot be opened and is 1byte.
Closing this issue. My bad. If anyone who will encounter in the future. I have Rails API. This solution worked.
https://github.com/caxlsx/caxlsx_rails#using-axlsx_rails-in-api-mode
I have a mailer which has the functionality to email with excel attached. It is working fine.
ActionController::Base.new.render_to_string layout: false, handlers: [:axlsx], formats: [:xlsx], template: ie.template_path, locals: ie.locals
However, on the controller to download same excel file, it is not working, it is not calling my view/template (I've added pry on my view(.xlsx.axlsx))
render xlsx: ie.filename, handlers: [:axlsx], formats: [:xlsx], template: ie.template_path, locals: ie.locals
They are using same service
ie = MyService.new(...)
It is not throwing any errors. Shows prompt the download, and if you download the file, it cannot be opened and is 1byte.