From f6d9b689977c1dca1ed7f149f704d1b4344cd691 Mon Sep 17 00:00:00 2001 From: Joan Karadimov Date: Thu, 20 Feb 2014 20:07:01 +0200 Subject: Check if the `request` variable isn't nil when calling render_to_string closes #14125 --- actionpack/lib/abstract_controller/rendering.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 349bbf4ee7..9d10140ed2 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -106,7 +106,9 @@ module AbstractController def _normalize_render(*args, &block) options = _normalize_args(*args, &block) #TODO: remove defined? when we restore AP <=> AV dependency - options[:variant] = request.variant if defined?(request) && request.variant.present? + if defined?(request) && request && request.variant.present? + options[:variant] = request.variant + end _normalize_options(options) options end -- cgit v1.2.3