Tested on Rails 5.1, for development, test and production (!).
At the top of your Gemfile
(don't add to :development
or :test
):
- Add
gem 'pry'
to yourGemfile
- Add
gem 'awesome_print'
to yourGemfile
Make sure you updated your application.rb
(not development.rb
):
module App
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
# ADD THESE 4 LINES:
console do
require 'pry'
config.console = Pry
end
end
end
Make sure to have the following in your ~/.pryrc
:
require 'awesome_print'
AwesomePrint.pry!
Then just spring stop && rails c
.
Without pry for rails:
With pry for rails:
I would also recommend adding these to your :development, :test
section:
gem 'pry-byebug' # for `next`, `step`, etc. commands
gem 'pry-stack_explorer' # for `show-stack` command