retrieve_response_from_mimes(mimes=nil, &block)
protected
Collects mimes and return the response for the negotiated format. Returns
nil if :not_acceptable was sent to the client.
# File actionpack/lib/action_controller/metal/mime_responds.rb, line 266
def retrieve_response_from_mimes(mimes=nil, &block) #:nodoc:
mimes ||= collect_mimes_from_class_level
collector = Collector.new(mimes) { |options| default_render(options || {}) }
block.call(collector) if block_given?
if format = request.negotiate_mime(collector.order)
self.content_type ||= format.to_s
lookup_context.freeze_formats([format.to_sym])
collector.response_for(format)
else
head :not_acceptable
nil
end
end