提交 d209aea7 编写于 作者: J José Valim 提交者: Yehuda Katz

Remove last TODO.

Signed-off-by: NYehuda Katz <wycats@gmail.com>
上级 fa0cf663
......@@ -263,11 +263,7 @@ def respond_with(resource, options={}, &block)
protected
def respond_to_block_or_template_or_resource(format, resource, options)
# TODO It should be just: self.formats = [ :foo ]
self.formats = [format.to_sym]
self.content_type = format
self.template.formats = [format.to_sym]
return yield if block_given?
begin
......
......@@ -11,11 +11,10 @@ def process_action(*)
def render(options)
super
options[:_template] ||= _action_view._partial
self.content_type ||= begin
mime = options[:_template].mime_type
formats.include?(mime && mime.to_sym) || formats.include?(:all) ? mime : Mime::Type.lookup_by_extension(formats.first)
end
end.to_s
response_body
end
......
......@@ -84,7 +84,7 @@ def lookup(string)
end
def lookup_by_extension(extension)
EXTENSION_LOOKUP[extension]
EXTENSION_LOOKUP[extension.to_s]
end
# Registers an alias that's not used on mime type lookup, but can be referenced directly. Especially useful for
......
......@@ -443,7 +443,7 @@ def render(*args)
@action = args.first[:action] unless args.empty?
@action ||= action_name
response.body = "#{@action} - #{@template.formats}"
response.body = "#{@action} - #{formats}"
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册