Created
December 14, 2012 13:59
-
-
Save stevenberg/4285636 to your computer and use it in GitHub Desktop.
Automatic Reloading in Rails Console
This file contains hidden or 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
| # http://jkfill.com/2012/12/08/automatic-code-reloading-in-rails-console | |
| # put this in config/initializeers/irb_reloading.rb | |
| if defined?(IRB::Context) && !defined?(Rails::Server) && Rails.env.development? | |
| class IRB::Context | |
| def evaluate_with_reloading(line, line_no) | |
| reload!(true) | |
| evaluate_without_reloading(line, line_no) | |
| end | |
| alias_method_chain :evaluate, :reloading | |
| end | |
| puts "=> IRB code reloading enabled" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment