Permalink
Browse files

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

closes #14125
  • Loading branch information...
1 parent 968c581 commit b9f6d144563e44de71683d5910aa849c88686098 @joankaradimov joankaradimov committed with chancancode 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 b9f6d14

Please sign in to comment.