Permalink
Browse files

Check if the `request` variable isn't nil when calling render_to_string

closes #14125
  • Loading branch information...
1 parent b078f5e commit f6d9b689977c1dca1ed7f149f704d1b4344cd691 @joankaradimov joankaradimov committed Feb 20, 2014
Showing with 3 additions and 1 deletion.
  1. +3 −1 actionpack/lib/abstract_controller/rendering.rb
View
4 actionpack/lib/abstract_controller/rendering.rb
@@ -106,7 +106,9 @@ def _process_format(format, options = {})
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

0 comments on commit f6d9b68

Please sign in to comment.