aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Dance + Gabriel Horner <ghorner+jd+gh@wegowise.com>2011-01-29 17:24:37 -0500
committerJonathan Dance + Gabriel Horner <ghorner+jd+gh@wegowise.com>2011-01-29 17:29:06 -0500
commitd1ef543794efdcc1d225055f88cbc88b20e84921 (patch)
tree907af117d282fa11371ca9fd71a2e2122286195b
parentfab16fded9a68cd327b6cfc5439ff10eed6df40b (diff)
downloadrails-d1ef543794efdcc1d225055f88cbc88b20e84921.tar.gz
rails-d1ef543794efdcc1d225055f88cbc88b20e84921.tar.bz2
rails-d1ef543794efdcc1d225055f88cbc88b20e84921.zip
explain different ways to use match()
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index ee0fdce9dd..b28b68ad83 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -256,15 +256,22 @@ module ActionDispatch
match '/', options.reverse_merge(:as => :root)
end
- # When you set up a regular route, you supply a series of symbols that
- # Rails maps to parts of an incoming HTTP request.
- #
- # match ':controller/:action/:id/:user_id'
- #
- # Two of these symbols are special: :controller maps to the name of a
- # controller in your application, and :action maps to the name of an
- # action within that controller. Anything other than :controller or
- # :action will be available to the action as part of params.
+ # Matches a pattern to one or more urls. Any symbols in a pattern are
+ # interpreted as url parameters:
+ #
+ # # sets parameters :controller, :action and :id
+ # match ':controller/:action/:id'
+ #
+ # Two of these symbols are special: <tt>:controller</tt> maps to the
+ # controller name and <tt>:action</tt> to the action name within that
+ # controller. Anything other than <tt>:controller</tt> or
+ # <tt>:action</tt> will be available to the action as part of +params+.
+ # If a pattern does not have :controller and :action symbols, then they
+ # must be set in options or shorthand. For example:
+ #
+ # match 'photos/:id' => 'photos#show'
+ # match 'photos/:id', :to => 'photos#show'
+ # match 'photos/:id', :controller => 'photos', :action => 'show'
#
# === Supported options
#