From af005df811dce7b602a07abeba40aff39799a9d0 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Tue, 6 Nov 2007 18:54:33 +0000 Subject: Add documentation for route conditions. Closes #9041 [innu, manfred] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8094 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_controller/routing.rb | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 46986d07e9..acba014554 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add documentation for route conditions. Closes #9041 [innu, manfred] + * Fix typo left over from previous typo fix in url helper. Closes #9414 [Henrik N] * Fixed that ActionController::CgiRequest#host_with_port() should handle standard port #10082 [moro] diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index a182fb3dd5..bebad04eab 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -204,6 +204,24 @@ module ActionController # must appear at the end of the path. The globbed values are in params[:path] in # this case. # + # == Route conditions + # + # With conditions you can define restrictions on routes. Currently the only valid condition is :method. + # + # * :method - Allows you to specify which method can access the route. Possible values are :post, + # :get, :put, :delete and :any. The default value is :any, + # :any means that any method can access the route. + # + # Example: + # + # map.connect 'post/:id', :controller => 'posts', :action => 'show', + # :conditions => { :method => :get } + # map.connect 'post/:id', :controller => 'posts', :action => 'create_comment', + # :conditions => { :method => :post } + # + # Now, if you POST to /posts/:id, it will route to the create_comment action. A GET on the same + # URL will route to the show action. + # # == Reloading routes # # You can reload routes if you feel you must: -- cgit v1.2.3