From 6ec07e0737c3099056fc11fe43f4f19dde3770a6 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 26 Aug 2008 16:17:58 -0500 Subject: Store application and other context specific helper modules in ActionView::Base#helpers --- actionpack/lib/action_view/base.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actionpack/lib/action_view/base.rb') diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index d174c784f3..c65048bfa0 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -208,10 +208,24 @@ module ActionView #:nodoc: ActionView::PathSet.new(Array(value)) end + attr_reader :helpers + + class ProxyModule < Module + def initialize(receiver) + @receiver = receiver + end + + def include(*args) + super(*args) + @receiver.extend(*args) + end + end + def initialize(view_paths = [], assigns_for_first_render = {}, controller = nil)#:nodoc: @assigns = assigns_for_first_render @assigns_added = nil @controller = controller + @helpers = ProxyModule.new(self) self.view_paths = view_paths end -- cgit v1.2.3