aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-03-13 23:29:30 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-03-13 23:29:30 +0530
commit800c70a8f9e6264e72019b1d8e18bddfa48f1373 (patch)
treef8d91928d5313a93248c0485a7c04e53f92bf856 /actionpack/lib/action_controller
parentcb7d19b66badfbd1846c195913419c331701074e (diff)
parenta9f688648cf91b3424710c185b0f17982734d4b6 (diff)
downloadrails-800c70a8f9e6264e72019b1d8e18bddfa48f1373.tar.gz
rails-800c70a8f9e6264e72019b1d8e18bddfa48f1373.tar.bz2
rails-800c70a8f9e6264e72019b1d8e18bddfa48f1373.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal/mime_responds.rb25
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 41809cf6a1..73e044a092 100644
--- a/actionpack/lib/action_controller/metal/mime_responds.rb
+++ b/actionpack/lib/action_controller/metal/mime_responds.rb
@@ -283,7 +283,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