Accessing the Rails Console on Heroku
Learn how to access and run queries in the Heroku console for a Ruby on Rails application.
Guide Tasks
- Read Tutorial
- Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license
Already a Bottega Student? Sign In
In this last video related to deployment, I'd like to show you how to access your production database on the command line.
It's actually quite similar to how you would use it locally.
To start, type:
heroku run rails c
Now, you can query, create, edit, view or do just about anything like you did it on the local system. For example, I'm going to check the last project record with the command
Project.last
This can be a powerful tool to access your production database, and you're sure to use it often, sometimes even on an everyday basis. It can be particularly useful for debugging your code.