Export User Data As CSV and Send An Email with Ruby on Rails

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 https://rubyonrails.ba/single/export-user-data-as-csv-and-send-an-email-with-ruby-on-rails

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles