Export User Data As CSV and Send An Email with Ruby on Rails
01-Oct-2022 1053
Sometimes we need to export user data we have in our app to comply with GDPR. So here I will explain how to export user data as a CSV file and attach it to an email or just upload it to ActiveStorage and S3.In this example code, I have an app where users save their financial transactions with bank accounts’ names, currencies, and transaction dates.We will create a temp file in the rails temp directory and then send it to SendGrid for email or storage. We will add the data to a temporary CSV file then call export_to_storage to save it to ActiveStorage to call send_email to send the user email with the attached CSV file.
Export User Data As CSV and Send An Email with Ruby on Rails #ruby #rubydeveloper #rubyonrails #Export #Email #Rails https://rubyonrails.ba/link/export-user-data-as-csv-and-send-an-email-with-ruby-on-rails