Pull plain
content type handling up to render
`render` is the only possible source for the `plain` option. Pulling the conditional up to the `render` method removes far away conditionals
This commit is contained in:
parent
fa09bf44db
commit
2ceb16e539
@ -23,7 +23,8 @@ module Rendering
|
||||
def render(*args, &block)
|
||||
options = _normalize_render(*args, &block)
|
||||
self.response_body = render_to_body(options)
|
||||
_process_format(rendered_format, options[:plain]) if rendered_format
|
||||
_process_format(rendered_format) if rendered_format
|
||||
self.content_type = Mime::TEXT if options[:plain]
|
||||
self.response_body
|
||||
end
|
||||
|
||||
@ -99,7 +100,7 @@ def _process_options(options)
|
||||
|
||||
# Process the rendered format.
|
||||
# :api: private
|
||||
def _process_format(format, plain = false)
|
||||
def _process_format(format)
|
||||
end
|
||||
|
||||
# Normalize args and options.
|
||||
|
@ -56,14 +56,10 @@ def _render_in_priorities(options)
|
||||
nil
|
||||
end
|
||||
|
||||
def _process_format(format, plain = false)
|
||||
def _process_format(format)
|
||||
super
|
||||
|
||||
if plain
|
||||
self.content_type = Mime::TEXT
|
||||
else
|
||||
self.content_type ||= format.to_s
|
||||
end
|
||||
self.content_type ||= format.to_s
|
||||
end
|
||||
|
||||
# Normalize arguments by catching blocks and setting them on :update.
|
||||
|
@ -104,7 +104,7 @@ def _render_template(options) #:nodoc:
|
||||
end
|
||||
|
||||
# Assign the rendered format to look up context.
|
||||
def _process_format(format, plain = false) #:nodoc:
|
||||
def _process_format(format) #:nodoc:
|
||||
super
|
||||
lookup_context.formats = [format.to_sym]
|
||||
lookup_context.rendered_format = lookup_context.formats.first
|
||||
|
Loading…
Reference in New Issue
Block a user