Created
October 7, 2008 18:14
-
-
Save chris/15331 to your computer and use it in GitHub Desktop.
This file contains 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
# My .irbrc | |
require 'rubygems' | |
require 'irb/completion' | |
require 'pp' | |
require 'wirble' | |
Wirble.init | |
Wirble.colorize | |
# The following is a way to let you call various helpers from the Rails console, see: | |
# http://errtheblog.com/posts/41-real-console-helpers | |
def Object.method_added(method) | |
return super(method) unless method == :helper | |
(class<<self;self;end).send(:remove_method, :method_added) | |
def helper(*helper_names) | |
returning $helper_proxy ||= Object.new do |helper| | |
helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize } | |
end | |
end | |
helper.instance_variable_set("@controller", ActionController::Integration::Session.new) | |
def helper.method_missing(method, *args, &block) | |
@controller.send(method, *args, &block) if @controller && method.to_s =~ /_path$|_url$/ | |
end | |
helper :application rescue nil | |
end if ENV['RAILS_ENV'] | |
def silence_output | |
conf.return_format = "" | |
end | |
def unsilence_output | |
conf.return_format = "=> %s\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment