lib/merb/merb_view_context.rb in merb-0.1.0 vs lib/merb/merb_view_context.rb in merb-0.2.0

- old
+ new

@@ -12,11 +12,10 @@ # just an empty container for us to fill with instance # variables from the controller, include helpers into # and then use as the context object passed to Erubis # when evaluating the templates. class ViewContext - include Merb::ErubisCaptureMixin include Merb::ViewContextMixin include Merb::FormControls include Merb::GlobalHelper def initialize(controller) @@ -29,15 +28,26 @@ rescue NameError MERB_LOGGER.info("Missing Helper: Merb::#{@controller.class.name}Helper") end end + # hack so markaby doesn't dup us and lose ivars. + def dup + self + end + # accessor for the view. refers to the current @controller object def controller @controller - end + end + + alias_method :old_respond_to?, :respond_to? + def respond_to?(sym, include_private=false) + old_respond_to?(sym, include_private) || @controller.respond_to?(sym, include_private) + end + # catch any method calls that the controller responds to # and delegate them back to the controller. def method_missing(sym, *args, &blk) if @controller.respond_to? sym @controller.send(sym, *args, &blk) @@ -46,6 +56,6 @@ end end end -end +end \ No newline at end of file