instance method
content_type=
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3Signature
content_type=(mime_type)
Sets the HTTP response’s content MIME type. For example, in the controller you could write this:
response.content_type = "text/plain"
If a character set has been defined for this response (see charset=) then the character set information will also be included in the content type information.
Parameters
-
mime_typereq
Source
# File actionpack/lib/action_controller/response.rb, line 64
def content_type=(mime_type)
self.headers["Content-Type"] =
if mime_type =~ /charset/ || (c = charset).nil?
mime_type.to_s
else
"#{mime_type}; charset=#{c}"
end
end
Defined in actionpack/lib/action_controller/response.rb line 64
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::AbstractResponse