aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG4
-rw-r--r--railties/lib/console_with_helpers.rb12
2 files changed, 12 insertions, 4 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index ce65b38f28..84f9727171 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,10 +1,10 @@
*SVN*
-* Make all ActionView helpers available in the console for debugging purposes. n.b.: Only an 80% solution. Some stuff won't work, most will. [Marcel Molina Jr.]
+* Make all ActionView helpers available in the console from the helper method for debugging purposes. n.b.: Only an 80% solution. Some stuff won't work, most will. [Marcel Molina Jr.]
ex.
- >> puts options_for_select([%w(a 1), %w(b 2), %w(c 3)])
+ >> puts helper.options_for_select([%w(a 1), %w(b 2), %w(c 3)])
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
diff --git a/railties/lib/console_with_helpers.rb b/railties/lib/console_with_helpers.rb
index cb317583e3..66a4248e0b 100644
--- a/railties/lib/console_with_helpers.rb
+++ b/railties/lib/console_with_helpers.rb
@@ -1,4 +1,4 @@
-module Kernel
+class Module
def include_all_modules_from(parent_module)
parent_module.constants.each do |const|
mod = parent_module.const_get(const)
@@ -10,6 +10,14 @@ module Kernel
end
end
+def helper
+ @helper_proxy ||= Object.new
+end
+
require 'application'
+
+class << helper
+ include_all_modules_from ActionView
+end
+
@controller = ApplicationController.new
-include_all_modules_from ActionView