2006-03-23 16:56:38 -05:00
|
|
|
class Module
|
2006-03-21 15:07:41 -05:00
|
|
|
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
|
|
|
|
|
2007-10-06 23:08:08 -04:00
|
|
|
def helper(*helper_names)
|
|
|
|
returning @helper_proxy ||= Object.new do |helper|
|
|
|
|
helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
|
|
|
|
end
|
2006-03-23 16:56:38 -05:00
|
|
|
end
|
|
|
|
|
2006-03-21 15:07:41 -05:00
|
|
|
require 'application'
|
2006-03-23 16:56:38 -05:00
|
|
|
|
|
|
|
class << helper
|
|
|
|
include_all_modules_from ActionView
|
|
|
|
end
|
|
|
|
|
2006-03-21 15:07:41 -05:00
|
|
|
@controller = ApplicationController.new
|
2007-10-06 23:08:08 -04:00
|
|
|
helper :application rescue nil
|