From 2c22376fe04b89e8f34620139720b85a85ce3428 Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Wed, 11 Jul 2012 12:18:52 +0400 Subject: Common behavior with adding formats to lookup_context for TemplateRenderer and PartialRenderer --- actionpack/lib/action_view/renderer/abstract_renderer.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/lib/action_view/renderer/abstract_renderer.rb') diff --git a/actionpack/lib/action_view/renderer/abstract_renderer.rb b/actionpack/lib/action_view/renderer/abstract_renderer.rb index 0b5d3785d4..b79b89e142 100644 --- a/actionpack/lib/action_view/renderer/abstract_renderer.rb +++ b/actionpack/lib/action_view/renderer/abstract_renderer.rb @@ -37,5 +37,11 @@ module ActionView def instrument(name, options={}) ActiveSupport::Notifications.instrument("render_#{name}.action_view", options){ yield } end + + def prepend_formats(formats) + formats = Array(formats) + return if formats.empty? || @lookup_context.html_fallback_for_js + @lookup_context.formats = formats | @lookup_context.formats + end end end -- cgit v1.2.3