aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/base.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-03-03 22:19:54 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-03-03 22:19:54 +0000
commitbf6d4cede7c4316321f9fafeda747ec3bfdf45c8 (patch)
treee733cd4675a59aabd21da24c4c82d3cc23f7a761 /actionpack/lib/action_controller/base.rb
parentbda4009aeed7b5498c3d361895102d6e1ebeb7a2 (diff)
downloadrails-bf6d4cede7c4316321f9fafeda747ec3bfdf45c8.tar.gz
rails-bf6d4cede7c4316321f9fafeda747ec3bfdf45c8.tar.bz2
rails-bf6d4cede7c4316321f9fafeda747ec3bfdf45c8.zip
Added user/password options for url_for to add http authentication in a URL [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6302 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/base.rb')
-rwxr-xr-xactionpack/lib/action_controller/base.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index a7b702cd3e..c0c14e55e0 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -495,6 +495,8 @@ module ActionController #:nodoc:
# is currently not recommended since it breaks caching.
# * <tt>:host</tt> -- overrides the default (current) host if provided
# * <tt>:protocol</tt> -- overrides the default (current) protocol if provided
+ # * <tt>:user</tt> -- Inline HTTP authentication (only plucked out if :password is also present)
+ # * <tt>:password</tt> -- Inline HTTP authentication (only plucked out if :user is also present)
#
# The URL is generated from the remaining keys in the hash. A URL contains two key parts: the <base> and a query string.
# Routes composes a query string as the key/value pairs not included in the <base>.
@@ -502,9 +504,10 @@ module ActionController #:nodoc:
# The default Routes setup supports a typical Rails path of "controller/action/id" where action and id are optional, with
# action defaulting to 'index' when not given. Here are some typical url_for statements and their corresponding URLs:
#  
- # url_for :controller => 'posts', :action => 'recent' # => 'proto://host.com/posts/recent'
- # url_for :controller => 'posts', :action => 'index' # => 'proto://host.com/posts'
- # url_for :controller => 'posts', :action => 'show', :id => 10 # => 'proto://host.com/posts/show/10'
+ # url_for :controller => 'posts', :action => 'recent' # => 'proto://host.com/posts/recent'
+ # url_for :controller => 'posts', :action => 'index' # => 'proto://host.com/posts'
+ # url_for :controller => 'posts', :action => 'show', :id => 10 # => 'proto://host.com/posts/show/10'
+ # url_for :controller => 'posts', :user => 'd', :password => '123' # => 'proto://d:123@host.com/posts'
#
# When generating a new URL, missing values may be filled in from the current request's parameters. For example,
# <tt>url_for :action => 'some_action'</tt> will retain the current controller, as expected. This behavior extends to