Jonathan Cutrell

Running Long One-Off Rails Console Commands Detached on Heroku

May 03, 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

Jonathan Cutrell

Written by Jonathan Cutrell, engineer at Clearbit and podcast host at Developer Tea. You can follow him on Twitter at @jcutrell.