Reputation: 11427
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
Upvotes: 0
Views: 1897
Reputation: 25984
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.
Upvotes: 2
Reputation: 22240
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 toirb
or the Railsscript/console
command
run console
is aimed at running the Rails console, or irb
.
Upvotes: 0