From 907d6ce28587593ec2bc93b4aeb216ca9d583a95 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sun, 7 Oct 2007 03:08:08 +0000 Subject: Extend the console +helper+ method to allow you to include custom helpers. Closes #6781 [Chris Wanstrath] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7765 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/console_with_helpers.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'railties/lib/console_with_helpers.rb') diff --git a/railties/lib/console_with_helpers.rb b/railties/lib/console_with_helpers.rb index 66a4248e0b..79018a9f76 100644 --- a/railties/lib/console_with_helpers.rb +++ b/railties/lib/console_with_helpers.rb @@ -10,8 +10,10 @@ class Module end end -def helper - @helper_proxy ||= Object.new +def helper(*helper_names) + returning @helper_proxy ||= Object.new do |helper| + helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize } + end end require 'application' @@ -21,3 +23,4 @@ class << helper end @controller = ApplicationController.new +helper :application rescue nil -- cgit v1.2.3