0

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

David Lazar
  • 10,865
  • 3
  • 25
  • 38

2 Answers2

2

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.

Konstantin Haase
  • 25,687
  • 2
  • 57
  • 59
0

From the docs:

You can use heroku console as a stand-in for Rails’s script runner, to run one-time commands directly from the command line

and

Without an argument, heroku console launches an interactive console similar to irb or the Rails script/console command

run console is aimed at running the Rails console, or irb.

Neil Middleton
  • 22,105
  • 18
  • 80
  • 134