aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r--actionpack/lib/abstract_controller/collector.rb6
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb11
2 files changed, 8 insertions, 9 deletions
diff --git a/actionpack/lib/abstract_controller/collector.rb b/actionpack/lib/abstract_controller/collector.rb
index ddd56b354a..3b5128cda5 100644
--- a/actionpack/lib/abstract_controller/collector.rb
+++ b/actionpack/lib/abstract_controller/collector.rb
@@ -7,7 +7,7 @@ module AbstractController
const = sym.upcase
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{sym}(*args, &block) # def html(*args, &block)
- custom(Mime::#{const}, *args, &block) # custom(Mime::HTML, *args, &block)
+ custom(Mime::Type[:#{const}], *args, &block) # custom(Mime::Type[:HTML], *args, &block)
end # end
RUBY
end
@@ -25,7 +25,7 @@ module AbstractController
def method_missing(symbol, &block)
const_name = symbol.upcase
- unless Mime.const_defined?(const_name)
+ unless Mime::Type.registered?(const_name)
raise NoMethodError, "To respond to a custom format, register it as a MIME type first: " \
"http://guides.rubyonrails.org/action_controller_overview.html#restful-downloads. " \
"If you meant to respond to a variant like :tablet or :phone, not a custom format, " \
@@ -33,7 +33,7 @@ module AbstractController
"format.html { |html| html.tablet { ... } }"
end
- mime_constant = Mime.const_get(const_name)
+ mime_constant = Mime::Type[const_name]
if Mime::SET.include?(mime_constant)
AbstractController::Collector.generate_method_for_mime(mime_constant)
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 6db0941b52..78b43f2fbe 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -24,9 +24,9 @@ module AbstractController
options = _normalize_render(*args, &block)
self.response_body = render_to_body(options)
if options[:html]
- _set_content_type Mime::HTML.to_s
+ _set_html_content_type
else
- _set_content_type _get_content_type(rendered_format)
+ _set_rendered_content_type rendered_format
end
self.response_body
end
@@ -55,7 +55,7 @@ module AbstractController
# Returns Content-Type of rendered content
# :api: public
def rendered_format
- Mime::TEXT
+ Mime::Type[:TEXT]
end
DEFAULT_PROTECTED_INSTANCE_VARIABLES = Set.new %i(
@@ -106,11 +106,10 @@ module AbstractController
def _process_format(format)
end
- def _get_content_type(rendered_format) # :nodoc:
- rendered_format.to_s
+ def _set_html_content_type # :nodoc:
end
- def _set_content_type(type) # :nodoc:
+ def _set_rendered_content_type(format) # :nodoc:
end
# Normalize args and options.