Skip to content

Instantly share code, notes, and snippets.

@mrhead
Created January 12, 2021 14:27
Show Gist options
  • Save mrhead/34b88855e91a8c24a5f4fb4083f7edd7 to your computer and use it in GitHub Desktop.
Save mrhead/34b88855e91a8c24a5f4fb4083f7edd7 to your computer and use it in GitHub Desktop.
# https://3.basecamp.com/3293071/buckets/5610905/todos/3353537510
site = Site.find(23219) # futureofgood
csv = CSV.generate force_quotes: true do |csv|
csv << ["Name", "Email", "Signup Date", "Initial Article", "Signup Article"]
site.members.where("created_at >= ?", "2020-11-01").find_each do |member|
csv << [
member.full_name,
member.email,
member.created_at.to_date,
member.tracking_params["initialArticle"],
member.tracking_params["signupArticle"]
]
end
end
HerokuExport.from_string(csv.to_s, filename: "members.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment