diff options
author | Mark Thomson <nzl216@gmail.com> | 2012-03-13 02:36:59 -0500 |
---|---|---|
committer | Mark Thomson <nzl216@gmail.com> | 2012-03-13 02:36:59 -0500 |
commit | 4cb71eaf463bb6a12edd1aaf222e9f1e3269bea7 (patch) | |
tree | f557f3854d55fc293db708e99d2851f1541e7d67 | |
parent | 64cd57aba989b396aaa749ff9ac83d80e3e63bc7 (diff) | |
download | rails-4cb71eaf463bb6a12edd1aaf222e9f1e3269bea7.tar.gz rails-4cb71eaf463bb6a12edd1aaf222e9f1e3269bea7.tar.bz2 rails-4cb71eaf463bb6a12edd1aaf222e9f1e3269bea7.zip |
Added documentation for the ActionController::MimeResponds::Collector class.
-rw-r--r-- | actionpack/lib/action_controller/metal/mime_responds.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb index 800752975c..f413a2f318 100644 --- a/actionpack/lib/action_controller/metal/mime_responds.rb +++ b/actionpack/lib/action_controller/metal/mime_responds.rb @@ -279,7 +279,30 @@ module ActionController #: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 |