Closed Kuassari closed 5 years ago
In rails 4 we used the paperclip gem, which is now deprecated in favor of ActiveStorage in rails 5. Active Storage has some helper methods that will help : https://guides.rubyonrails.org/active_storage_overview.html
@Kuassari If you are looking to write a template to a file, look at something like this: https://gist.github.com/straydogstudio/323139591f2cc5d48fbc or https://gist.github.com/straydogstudio/dceb775ead81470cea70 I assume you'll do that in your job.
Then you'll have to read and serve the file in a controller action. That should be pretty straight forward.
So I work with mailer and sidekiq. I try to make the file not as attachment in the mail, but as a url that leads to a function in a controller so it can send file to the user after it was saved locally. I didn't see anything like that in the documentation and no matter what I try I get errors like 'undefined url' or 'no implicit conversion of nil into String'.
I searched every issue here and questions on stackoverflow and didn't find an answer. I have a location I prepared and saved and I want to tell the template somehow to save it in this specific location so I can access it later when the user click on the download link.
Relevant parts of my code:
Job:
Mailer:
download function: