Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

automatic Rails environment loading

  • Loading branch information...
commit 77997e8d752aa099dcc025d99c7fa454965c00a0 1 parent 707c9a4
@morhekil authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 pryrc
View
20 pryrc
@@ -176,3 +176,23 @@ module CodeRay
end
end
end
+
+
+# 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'
+ else
+ warn "[WARN] cannot load Rails console commands (Not on Rails2 or Rails3?)"
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.