aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDallas Taylor <dallastaylor@gmail.com>2009-04-27 17:46:18 +0100
committerDallas Taylor <dallastaylor@gmail.com>2009-04-27 17:46:18 +0100
commit8e93e929a171907727f7e63f7669cf1c3141abdc (patch)
tree1da22f7fcffe8db2db4d0341a9225d6b3ddc940d /actionpack
parent9d9adc998d5d0abba39d1ac06254cabf8bc93d55 (diff)
parentde9ea3bf252799aea2b1b923f3153ec4d85226d1 (diff)
downloadrails-8e93e929a171907727f7e63f7669cf1c3141abdc.tar.gz
rails-8e93e929a171907727f7e63f7669cf1c3141abdc.tar.bz2
rails-8e93e929a171907727f7e63f7669cf1c3141abdc.zip
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/base/mime_responds.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/base/mime_responds.rb b/actionpack/lib/action_controller/base/mime_responds.rb
index bac225ab2a..a91483b0f0 100644
--- a/actionpack/lib/action_controller/base/mime_responds.rb
+++ b/actionpack/lib/action_controller/base/mime_responds.rb
@@ -94,6 +94,18 @@ module ActionController #:nodoc:
# Note that you can define your own XML parameter parser which would allow you to describe multiple entities
# in a single request (i.e., by wrapping them all in a single root node), but if you just go with the flow
# and accept Rails' defaults, life will be much easier.
+ #
+ # Further more, you may call the #any method on the block's object in order to run the same code for different responses.
+ # def index
+ #
+ # respond_to do |format|
+ # format.html { @people = People.all(:limit => 10) }
+ # format.any(:xml, :atom) { @people = People.all }
+ # end
+ # end
+ #
+ # This will limit the @people variable to 10 people records if we're requesting HTML, but will list all the
+ # people for any xml or atom request.
#
# If you need to use a MIME type which isn't supported by default, you can register your own handlers in
# environment.rb as follows.