Search code examples
herokuconsolesinatrairbcedar

Heroku Cedar Stack and command heroku run console


In my old Ruby 1.9.2 Sinatra apps running on Bamboo stack, heroku console provided a shell that not only initialized Active Record but also logged to a history file in my .heroku directory.

After moving to Heroku Cedar stack and using Ruby 1.9.3, I found heroku run console did not load any of my Active Record models. I fixed that by writing a small ruby script to initialize Active Record and load my models.

I execute this using the awkward heroku run 'bundle exec irb -r ./console'

This IRB console fires up fine and gives me access to my model data, but no history is logged.

1) Why is heroku run console so neutered? 2) How can I get my console sessions to log to history?

Please?

Thanks


Solution

  • Add the following line to your Procfile:

    console: bundle exec irb -r ./console
    

    Keeping the history is not easily possible, as it will spin up a dyno for every new invocation (cedar stack doesn't keep the history for Rails console, either). You could try using rlwrap to keep your history on the local machine.