Skip to content

Instantly share code, notes, and snippets.

@defong
Created February 24, 2021 11:52
Show Gist options
  • Save defong/014fd11a17ce93c9004c34f2365c550e to your computer and use it in GitHub Desktop.
Save defong/014fd11a17ce93c9004c34f2365c550e to your computer and use it in GitHub Desktop.
[DfE] lead_school.rb
items = (RecruitmentCycle.current.providers.lead_school.map do |p|
p.users.non_admins.map do |u|
{
provider_name: p.provider_name,
email: u.email,
}
end
end).flatten
CSV.open("#{Rails.configuration.database_configuration["development"]["database"]}-lead_school.csv", "wb") do |csv|
csv << items.first.keys
items.each do |hash|
csv << hash.values
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment