Created
May 27, 2009 17:13
-
-
Save tomkersten/118758 to your computer and use it in GitHub Desktop.
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
require 'rubygems' | |
require 'irb/completion' | |
require 'irb/ext/save-history' | |
require 'utility_belt' | |
IRB.conf[:SAVE_HISTORY] = 300 | |
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history" | |
IRB.conf[:PROMPT_MODE] = :SIMPLE | |
ARGV.concat [ "--readline", "--prompt-mode", "simple" ] | |
# Just for Rails... | |
if rails_env = ENV['RAILS_ENV'] | |
# Set up so named routes will work in ./script/console | |
require 'action_controller' | |
include ActionController::UrlWriter | |
default_url_options[:host] = "http://localhost:3000" | |
rails_root = File.basename(Dir.pwd) | |
IRB.conf[:PROMPT] ||= {} | |
IRB.conf[:PROMPT][:RAILS] = { | |
:PROMPT_I => "#{rails_root}> ", | |
:PROMPT_S => "#{rails_root}* ", | |
:PROMPT_C => "#{rails_root}? ", | |
:RETURN => "=> %s\n" | |
} | |
IRB.conf[:PROMPT_MODE] = :RAILS | |
# Called after the irb session is initialized and Rails has | |
# been loaded (props: Mike Clark). | |
IRB.conf[:IRB_RC] = Proc.new do | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.instance_eval { alias :[] :find } | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment