Skip to content

Instantly share code, notes, and snippets.

@equivalentideas
Created May 24, 2017 01:03
Show Gist options
  • Save equivalentideas/39585f72451a542fe11e646769cf5933 to your computer and use it in GitHub Desktop.
Save equivalentideas/39585f72451a542fe11e646769cf5933 to your computer and use it in GitHub Desktop.
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