aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb13
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb5
-rw-r--r--actionpack/lib/action_view/template/resolver.rb2
3 files changed, 16 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index edfd1fd71c..ec1b07797b 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -175,6 +175,17 @@ module ActionView #:nodoc:
attr_accessor :controller
attr_internal :captures
+ def reset_formats(formats)
+ @formats = formats
+
+ if defined?(ActionController)
+ # This is expensive, but we need to reset this when the format is updated,
+ # which currently only happens
+ Thread.current[:format_locale_key] =
+ ActionController::HashKey.get(self.class, formats, I18n.locale)
+ end
+ end
+
class << self
delegate :erb_trim_mode=, :to => 'ActionView::TemplateHandlers::ERB'
delegate :logger, :to => 'ActionController::Base', :allow_nil => true
@@ -240,7 +251,7 @@ module ActionView #:nodoc:
end
def initialize(view_paths = [], assigns_for_first_render = {}, controller = nil, formats = nil)#:nodoc:
- @formats = formats || [:html]
+ @formats = formats
@assigns = assigns_for_first_render.each { |key, value| instance_variable_set("@#{key}", value) }
@controller = controller
@helpers = self.class.helpers || Module.new
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index 624b537ad2..03f1dabb4e 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -991,12 +991,13 @@ module ActionView
def render(*options_for_render)
old_formats = @context && @context.formats
- @context.formats = [:html] if @context
+
+ @context.reset_formats([:html]) if @context
Hash === options_for_render.first ?
@context.render(*options_for_render) :
options_for_render.first.to_s
ensure
- @context.formats = old_formats if @context
+ @context.reset_formats(old_formats) if @context
end
def javascript_object_for(object)
diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb
index 10f664736f..fe657166d5 100644
--- a/actionpack/lib/action_view/template/resolver.rb
+++ b/actionpack/lib/action_view/template/resolver.rb
@@ -42,7 +42,7 @@ module ActionView
def handler_glob
@handler_glob ||= begin
- e = TemplateHandlers.extensions.map{|h| ".#{h},"}.join
+ e = TemplateHandlers.extensions.map{|h| ".#{h}"}.join(",")
"{#{e}}"
end
end