Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Command to create markdown file of visible comments on a planning application in PlanningAlerts
# Run these commands on the production Rails console
# This creates a markdown file with the comments in the format:
#
# From: Luke Bacon
# Date of Submission: 6 April 2017
#
# Comment text bla bla bla
#
# * * *
#
app_number = 793257
File.open("application_#{app_number}_comments.md", "w") {|file| Application.find(app_number).comments.visible.each {|c| file.puts "From: #{c.name}\nDate of Submission: #{c.confirmed_at.strftime('%e %B %Y').strip}\n\n#{c.text}\n\n* * *\n\n"} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment