提交 d75a2345 编写于 作者: J Joshua Peek

simplify console with helpers

上级 d3615879
......@@ -42,6 +42,7 @@ module ClassMethods
include FormHelper
include FormOptionsHelper
include FormTagHelper
include JavaScriptHelper
include NumberHelper
include PrototypeHelper
include RecordIdentificationHelper
......
class Module
def include_all_modules_from(parent_module)
parent_module.constants.each do |const|
mod = parent_module.const_get(const)
if mod.class == Module
send(:include, mod)
include_all_modules_from(mod)
end
end
end
end
def helper(*helper_names)
returning @helper_proxy ||= Object.new do |helper|
helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
end
end
class << helper
include_all_modules_from ActionView
def helper
@helper ||= ApplicationController.helpers
end
@controller = ApplicationController.new
helper :application rescue nil
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册