Skip to content

Instantly share code, notes, and snippets.

@cluesque
Created January 14, 2021 21:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cluesque/a5a9720f082aa32a38cce08469c3a076 to your computer and use it in GitHub Desktop.
Save cluesque/a5a9720f082aa32a38cce08469c3a076 to your computer and use it in GitHub Desktop.
For rails console pry is a much better REPL than IRB, so why not use it in production?

Only a couple of changes are necessary. Not sure I love the config/application.rb change...

# Your typical config/application.rb
module MyApplication
class Application < Rails::Application
# ... probably lots of other stuff
console do
require 'pry'
config.console = Pry
end
# ...
end
end
# This goes at global scope (remove it from your other groups)
gem 'pry-rails', require: false
gem 'pry-byebug', require: false
# config/initializers/pry.rb
unless Rails.env.production?
require 'pry' # support binding.pry breakpoints in development and test
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment