aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/mime_responds.rb
diff options
context:
space:
mode:
authorDaniel Schierbeck <daniel.schierbeck@gmail.com>2019-01-16 11:13:48 +0100
committerGitHub <noreply@github.com>2019-01-16 11:13:48 +0100
commitf19b60b6f7dde934451a31d291869f39364a67cf (patch)
treef123b43d3c067482503051e890e95d0b932c13a0 /actionpack/lib/action_controller/metal/mime_responds.rb
parenta08827a90b5a9be79379019cf5b242bd7236d2e3 (diff)
downloadrails-f19b60b6f7dde934451a31d291869f39364a67cf.tar.gz
rails-f19b60b6f7dde934451a31d291869f39364a67cf.tar.bz2
rails-f19b60b6f7dde934451a31d291869f39364a67cf.zip
Document that `format.any` can match all formats
I had to dig around the code to discover this, since I had a use case for the behavior.
Diffstat (limited to 'actionpack/lib/action_controller/metal/mime_responds.rb')
-rw-r--r--actionpack/lib/action_controller/metal/mime_responds.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb
index 118da11990..bf5e7a433f 100644
--- a/actionpack/lib/action_controller/metal/mime_responds.rb
+++ b/actionpack/lib/action_controller/metal/mime_responds.rb
@@ -124,6 +124,14 @@ module ActionController #:nodoc:
#
# render json: @people
#
+ # +any+ can also be used with no arguments, in which case it will be used for any format requested by
+ # the user:
+ #
+ # respond_to do |format|
+ # format.html
+ # format.any { redirect_to support_path }
+ # end
+ #
# Formats can have different variants.
#
# The request variant is a specialization of the request format, like <tt>:tablet</tt>,