Jonathan Cutrell

Running Long One-Off Rails Console Commands Detached on Heroku

5/3/2017

Ever wanted to run some kind of one-off thing without pushing up a rake task? I came across this today and needed to clear out some database records. This works wonderfully:

heroku run:detached rails runner 'SomeModel.long_running_method' -r heroku

Written by Jonathan Cutrell, Engineering Manager at Guild Education and podcast host at Developer Tea. You can follow him on Twitter at @jcutrell.