提交 7ef6a27f 编写于 作者: A Aaron Patterson

add Mime.fetch so we can have default mime types

上级 142d50e5
......@@ -581,8 +581,7 @@ def build_request_uri(action, parameters)
def html_format?(parameters)
return true unless parameters.is_a?(Hash)
format = Mime[parameters[:format]]
format.nil? || format.html?
Mime.fetch(parameters[:format]) { Mime['html'] }.html?
end
end
......
......@@ -29,6 +29,11 @@ def self.[](type)
Type.lookup_by_extension(type.to_s)
end
def self.fetch(type)
return type if type.is_a?(Type)
EXTENSION_LOOKUP.fetch(type.to_s) { |k| yield k }
end
# Encapsulates the notion of a mime type. Can be used at render time, for example, with:
#
# class PostsController < ActionController::Base
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册