Created
August 15, 2013 20:33
-
-
Save kyletolle/6244558 to your computer and use it in GitHub Desktop.
my .pryrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
begin | |
require 'awesome_print' | |
AwesomePrint.pry! | |
#Pry.config.print = proc { |output, value| output.puts value.ai } | |
rescue LoadError => err | |
puts "no awesome_print :(" | |
end | |
if Rails.version[0..0] == "2" | |
require 'console_app' | |
require 'console_with_helpers' | |
elsif Rails.version[0..0] == "3" || Rails.version[0..0] == "4" | |
require 'rails/console/app' | |
require 'rails/console/helpers' | |
else | |
warn "[WARN] cannot load Rails console commands (Not on Rails2 or Rails3?)" | |
end | |
end | |
# Idea from: http://stackoverflow.com/questions/15536815/opening-the-pry-console-in-sandbox-mode | |
def sandbox | |
require 'active_record/railties/console_sandbox' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment