Skip to content

Instantly share code, notes, and snippets.

@bsodmike bsodmike/.pryrc

Created Oct 4, 2012
What would you like to do?
Rails 3.2+ support for Pry including accessing the Rails environment
# Load plugins (only those I whitelist)
Pry.config.should_load_plugins = false
# Launch Pry with access to the entire Rails stack.
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead.
# If you don't, you can load it through the lines below :)
rails = File.join Dir.getwd, 'config', 'environment.rb'
if File.exist?(rails) && ENV['SKIP_RAILS'].nil?
require rails
if Rails.version[0..0] == "2"
require 'console_app'
require 'console_with_helpers'
elsif Rails.version[0..0] == "3"
require 'rails/console/app'
require 'rails/console/helpers'
warn "[WARN] cannot load Rails console commands (Not on Rails2 or Rails3?)"
if defined?(Rails) && Rails.env
extend Rails::ConsoleMethods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.