aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJoan Karadimov <joan.karadimov@gmail.com>2014-02-20 20:07:01 +0200
committerJoan Karadimov <joan.karadimov@gmail.com>2014-02-20 20:53:47 +0200
commitf6d9b689977c1dca1ed7f149f704d1b4344cd691 (patch)
tree1b06ba19868942f1a31c52e33a95dd74d1f26637 /actionpack
parentb078f5ed843f23c61412ab21a94613377c9ad052 (diff)
downloadrails-f6d9b689977c1dca1ed7f149f704d1b4344cd691.tar.gz
rails-f6d9b689977c1dca1ed7f149f704d1b4344cd691.tar.bz2
rails-f6d9b689977c1dca1ed7f149f704d1b4344cd691.zip
Check if the `request` variable isn't nil when calling render_to_string
closes #14125
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb4
1 files changed, 3 insertions, 1 deletions
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