Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: 24c2729e6e
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (34 sloc) 2.449 kb
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">
<title><![CDATA[Category: console | Entreprevelopment adventures]]></title>
<link href="" rel="self"/>
<link href=""/>
<name><![CDATA[Luisa Lima]]></name>
<generator uri="">Octopress</generator>
<title type="html"><![CDATA[Adding automatic code reloading to rails console]]></title>
<link href=""/>
<content type="html"><![CDATA[<p>So I have no idea why the rails console in development mode doesn't already do this, since the whole idea of the console in development mode is for us to mess around and test random stuff in development mode, right? Anyway, I got inspired and helped by <a href="">Jkfill</a> with his post on <a href="">Automatic Code Reloading in Rails Console</a>, so here goes, more for my records than yours since you should follow the instructions in his post. I am using Rails 3.2.9, so I had to copy the code from the <a href="">reload! method in the rails console code</a>, which is not exactly the best practice, but it's just for dev mode and it works :-)</p>
<pre><code> #this should be in config/initializers/irb_reloading.rb
if defined?(IRB::Context) && !defined?(Rails::Server) && Rails.env.development?
class IRB::Context
def evaluate_with_reloading(line, line_no)
evaluate_without_reloading(line, line_no)
alias_method_chain :evaluate, :reloading
puts "=> IRB code reloading enabled"
<p>In the meanwhile, shortly browsed the code at <a href="">the Rails gihub project</a> and it's really a nice way to learn more about rails... must do it more often.</p>
Jump to Line
Something went wrong with that request. Please try again.