Micha
Micha

Reputation: 281

Heroku rails console does not start any more

I have an issue with running the rails console at heroku (cedar-stack). Each of the following commands heroku run console, heroku run rails console, heroku run bundle exec rails console results in the following error-message:

Running bundle exec rails console attached to terminal... up, run.8155

Abort testing: Your Rails environment is running in production mode!

This error-message is a little bit confused. What kind of test tries heroku to start? I just want to fire up the console, which had worked fine 4 weeks ago.

Upvotes: 23

Views: 23654

Answers (5)

Naiguel Developer
Naiguel Developer

Reputation: 313

I was with the same problem and I decided to do this and it worked

$ heroku run bash
$ cd bin
~/bin $ ruby rails console

Upvotes: 3

Chris Barretto
Chris Barretto

Reputation: 9529

For Cedar Stack and later:

heroku run rails console --app <app name>

Previous stacks could use this command:

heroku run console --app <app name>

Upvotes: 46

If you have multiple environments (staging / production / etc) you need this command:

heroku run -a app-name console

If you only have a single environment and never setup staging or other environments you can just run:

heroku run console

https://github.com/nemrow/rails_app_cheatsheet/blob/master/heroku.rdoc

Upvotes: 19

jordelver
jordelver

Reputation: 8432

You should just use heroku run console as others have answered.

Heroku only runs in one environment at a time, which is configured by the RAILS_ENV and RACK_ENV environments variables.

When you connect, the console will use the correct environment automatically.

Upvotes: 1

Christos Zisopoulos
Christos Zisopoulos

Reputation: 31

For some reason you need to explicitly define the console process in the Procfile:

# Procfile

web: script/rails server -p $PORT
console: script/rails console

This blog post has more details: http://platypus.belighted.com/blog/2013/01/21/ruby-2-rails-4-heroku/

Upvotes: 3

Related Questions