lib/action_view/base.rb in actionpack-0.9.0 vs lib/action_view/base.rb in actionpack-0.9.5
- old
+ new
@@ -139,10 +139,20 @@
class_eval("include ActionView::Helpers::#{helper_module_name}") if Helpers.const_defined?(helper_module_name)
end
end
+ def self.controller_delegate(*methods)
+ methods.flatten.each do |method|
+ class_eval <<-end_eval
+ def #{method}(*args, &block)
+ controller.send(%(#{method}), *args, &block)
+ end
+ end_eval
+ end
+ end
+
def initialize(base_path = nil, assigns_for_first_render = {}, controller = nil)#:nodoc:
@base_path, @assigns = base_path, assigns_for_first_render
@controller = controller
end
@@ -243,9 +253,10 @@
@@compiled_erb_templates[template] ||= ERB.new(template)
@@compiled_erb_templates[template].result(binding)
end
def rxml_render(template, binding)
+ @controller.headers["Content-Type"] ||= 'text/xml'
eval(template, binding)
end
end
end