提交 4cb71eaf 编写于 作者: M Mark Thomson

Added documentation for the ActionController::MimeResponds::Collector class.

上级 64cd57ab
......@@ -279,7 +279,30 @@ def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
end
end
class Collector #:nodoc:
# A container of responses available for requests with different mime-types
# sent to the current controller action.
#
# The public controller methods +respond_with+ and +respond_to+ may be called
# with a block that is used to define responses to different mime-types, e.g.
# for +respond_to+ :
#
# respond_to do |format|
# format.html
# format.xml { render :xml => @people.to_xml }
# end
#
# In this usage, the argument passed to the block (+format+ above) is an
# instance of the ActionController::MimeResponds::Collector class. This
# object serves as a container in which available responses can be stored by
# calling any of the dynamically generated, mime-type-specific methods such
# as +html+, +xml+ etc on the Collector. Each response is represented by a
# corresponding block if present.
#
# A subsequent call to #negotiate_format(request) will enable the Collector
# to determine which specific mime-type it should respond with for the current
# request, with this response then being accessible by calling #response.
#
class Collector
include AbstractController::Collector
attr_accessor :order, :format
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册