Replace the Rails Console With Pry


Programming in Ruby tutorials and examples

Replace the Rails Console With Pry

MaxCDN Content Delivery Network

If like me you prefer to use Pry over IRB you probably want your rails app to start Pry with your rails environment loaded instead of IRB when running the rails console.

Luckily it’s really easy to do. Just open up config/environments/development.rb and add the following code.

MyApp::Application.configure do
    silence_warnings do
        begin
            require 'pry'
            IRB = Pry
        rescue LoadError
        end
    end
end

Simples!