提交 769b25af 编写于 作者: K Kasper Timm Hansen 提交者: GitHub

Merge pull request #24596 from maclover7/jm-cleanup-3

Extract variant setter to process method
......@@ -109,6 +109,9 @@ def _process_options(options)
def _process_format(format)
end
def _process_variant(options)
end
def _set_html_content_type # :nodoc:
end
......@@ -119,10 +122,7 @@ def _set_rendered_content_type(format) # :nodoc:
# :api: private
def _normalize_render(*args, &block)
options = _normalize_args(*args, &block)
#TODO: remove defined? when we restore AP <=> AV dependency
if defined?(request) && !request.nil? && request.variant.present?
options[:variant] = request.variant
end
_process_variant(options)
_normalize_options(options)
options
end
......
......@@ -54,6 +54,12 @@ def render_to_body(options = {})
private
def _process_variant(options)
if defined?(request) && !request.nil? && request.variant.present?
options[:variant] = request.variant
end
end
def _render_in_priorities(options)
RENDER_FORMATS_IN_PRIORITY.each do |format|
return options[format] if options.key?(format)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册