2007-01-22 14:43:50 +01:00
|
|
|
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
|
|
|
|
|
2007-12-21 08:48:59 +01:00
|
|
|
def helper(*helper_names)
|
|
|
|
returning @helper_proxy ||= Object.new do |helper|
|
|
|
|
helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
|
|
|
|
end
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
require 'application'
|
|
|
|
|
|
|
|
class << helper
|
|
|
|
include_all_modules_from ActionView
|
|
|
|
end
|
|
|
|
|
|
|
|
@controller = ApplicationController.new
|
2007-12-21 08:48:59 +01:00
|
|
|
helper :application rescue nil
|