Created
February 24, 2021 11:52
-
-
Save defong/014fd11a17ce93c9004c34f2365c550e to your computer and use it in GitHub Desktop.
[DfE] lead_school.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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