Skip to content

Instantly share code, notes, and snippets.

require 'csv'
namespace :education do
desc "generate governance csv"
task governance: [:environment] do
# open new csv for writing
CSV.open("school-governance-results.csv", "wb") do |csv|
# iterating existing csv rows
CSV.foreach('school-governance.csv') do |row|
c = ContentItem.find_by title: row.join(',')
arr = []
content:
title: "Coronavirus (COVID-19): guidance and support"
meta_description: "Find information on coronavirus, including guidance, support, announcements and statistics."
page_header: "Coronavirus (COVID‑19)"
header_section:
title: There are three simple actions we must all do to keep on protecting each other
list:
- instruction: wash hands
detail: keep washing your hands regularly
- instruction: cover face
content:
title: "Coronavirus (COVID-19): guidance and support"
meta_description: "Find information on coronavirus, including guidance, support, announcements and statistics."
page_header: "Coronavirus (COVID‑19)"
header_section:
title: There are three simple actions we must all do to keep on protecting each other
list:
- instruction: wash hands
detail: keep washing your hands regularly
- instruction: cover face
content:
title: "Coronavirus (COVID-19): guidance and support"
meta_description: "Find information on coronavirus, including guidance, support, announcements and statistics."
page_header: "Coronavirus (COVID‑19)"
header_section:
title: There are three simple actions we must all do to keep on protecting each other
list:
- instruction: wash hands
detail: keep washing your hands regularly
- instruction: cover face