<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,11 +1,13 @@
 irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
 
 require 'optparse'
+
 options = { :sandbox =&gt; false, :irb =&gt; irb }
 OptionParser.new do |opt|
   opt.banner = &quot;Usage: console [environment] [options]&quot;
   opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
   opt.on(&quot;--irb=[#{irb}]&quot;, 'Invoke a different irb.') { |v| options[:irb] = v }
+  opt.on(&quot;--debugger&quot;, 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
   opt.parse!(ARGV)
 end
 
@@ -15,6 +17,17 @@ libs &lt;&lt; &quot; -r console_app&quot;
 libs &lt;&lt; &quot; -r console_sandbox&quot; if options[:sandbox]
 libs &lt;&lt; &quot; -r console_with_helpers&quot;
 
+if options[:debugger]
+  begin
+    require 'ruby-debug'
+    libs &lt;&lt; &quot; -r ruby-debug&quot;
+    puts &quot;=&gt; Debugger enabled&quot;
+  rescue Exception
+    puts &quot;You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'&quot;
+    exit
+  end
+end
+
 ENV['RAILS_ENV'] = case ARGV.first
   when &quot;p&quot;; &quot;production&quot;
   when &quot;d&quot;; &quot;development&quot;</diff>
      <filename>railties/lib/commands/console.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1ddde91303883b47f2215779cf45d7008377bd0d</id>
    </parent>
  </parents>
  <author>
    <name>miloops</name>
    <email>miloops@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/c98cb8ffc2f42bff565994951af9412e52fcdc58</url>
  <id>c98cb8ffc2f42bff565994951af9412e52fcdc58</id>
  <committed-date>2008-09-11T08:12:00-07:00</committed-date>
  <authored-date>2008-09-11T08:06:36-07:00</authored-date>
  <message>Add --debugger option to script/console.

Signed-off-by: Michael Koziarski &lt;michael@koziarski.com&gt;
[#1025 state:committed]</message>
  <tree>fcff77ec4ef21c087ade81c6b03a8eb75ea410c1</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
