aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorMatt Jones <al2o3cr@gmail.com>2008-11-14 11:46:19 -0500
committerMatt Jones <al2o3cr@gmail.com>2008-11-14 11:46:19 -0500
commit779df30087a9372e4a40a75d416e95585ea47c54 (patch)
treeeb057958cb3b1943258904cc08a6fcbe295c5269 /actionpack/lib
parent0a2d779e22d522c9d4ee149b51db2641ac89f294 (diff)
downloadrails-779df30087a9372e4a40a75d416e95585ea47c54.tar.gz
rails-779df30087a9372e4a40a75d416e95585ea47c54.tar.bz2
rails-779df30087a9372e4a40a75d416e95585ea47c54.zip
Update info on routing parameter defaults, better example for :requirements in map.resource.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/resources.rb7
-rw-r--r--actionpack/lib/action_controller/routing.rb6
2 files changed, 10 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/resources.rb b/actionpack/lib/action_controller/resources.rb
index 7700b9d4d0..3b97916682 100644
--- a/actionpack/lib/action_controller/resources.rb
+++ b/actionpack/lib/action_controller/resources.rb
@@ -283,7 +283,12 @@ module ActionController
# * <tt>:new</tt> - Same as <tt>:collection</tt>, but for actions that operate on the new \resource action.
# * <tt>:controller</tt> - Specify the controller name for the routes.
# * <tt>:singular</tt> - Specify the singular name used in the member routes.
- # * <tt>:requirements</tt> - Set custom routing parameter requirements.
+ # * <tt>:requirements</tt> - Set custom routing parameter requirements; this is a hash of either
+ # regular expressions (which must match for the route to match) or extra parameters. For example:
+ #
+ # map.resource :profile, :path_prefix => ':name', :requirements => { :name => /[a-zA-Z]+/, :extra => 'value' }
+ #
+ # will only match if the first part is alphabetic, and will pass the parameter :extra to the controller.
# * <tt>:conditions</tt> - Specify custom routing recognition conditions. \Resources sets the <tt>:method</tt> value for the method-specific routes.
# * <tt>:as</tt> - Specify a different \resource name to use in the URL path. For example:
# # products_path == '/productos'
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index 8d51e823a6..2dcdac150a 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -84,9 +84,11 @@ module ActionController
# This sets up +blog+ as the default controller if no other is specified.
# This means visiting '/' would invoke the blog controller.
#
- # More formally, you can define defaults in a route with the <tt>:defaults</tt> key.
+ # More formally, you can include arbitrary parameters in the route, thus:
#
- # map.connect ':controller/:action/:id', :action => 'show', :defaults => { :page => 'Dashboard' }
+ # map.connect ':controller/:action/:id', :action => 'show', :page => 'Dashboard'
+ #
+ # This will pass the :page parameter to all incoming requests that match this route.
#
# Note: The default routes, as provided by the Rails generator, make all actions in every
# controller accessible via GET requests. You should consider removing them or commenting