Changeset 7331
- Timestamp:
- 08/17/07 01:08:16 (1 year ago)
- Files:
-
- trunk/actionpack/lib/action_controller/base.rb (modified) (2 diffs)
- trunk/actionpack/lib/action_controller/url_rewriter.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/base.rb
r7181 r7331 515 515 # * <tt>:trailing_slash</tt> -- if true, adds a trailing slash, as in "/archive/2005/". Note that this 516 516 # is currently not recommended since it breaks caching. 517 # * <tt>:host</tt> -- overrides the default (current) host if provided 518 # * <tt>:protocol</tt> -- overrides the default (current) protocol if provided 519 # * <tt>:user</tt> -- Inline HTTP authentication (only plucked out if :password is also present) 520 # * <tt>:password</tt> -- Inline HTTP authentication (only plucked out if :user is also present) 517 # * <tt>:host</tt> -- overrides the default (current) host if provided. 518 # * <tt>:protocol</tt> -- overrides the default (current) protocol if provided. 519 # * <tt>:port</tt> -- optionally specify the port to connect to. 520 # * <tt>:user</tt> -- Inline HTTP authentication (only plucked out if :password is also present). 521 # * <tt>:password</tt> -- Inline HTTP authentication (only plucked out if :user is also present). 522 # * <tt>:skip_relative_url_root</tt> -- if true, the url is not constructed using the relative_url_root of the request so the path 523 # will include the web server relative installation directory. 521 524 # 522 525 # The URL is generated from the remaining keys in the hash. A URL contains two key parts: the <base> and a query string. … … 525 528 # The default Routes setup supports a typical Rails path of "controller/action/id" where action and id are optional, with 526 529 # action defaulting to 'index' when not given. Here are some typical url_for statements and their corresponding URLs: 527 # Â 528 # url_for :controller => 'posts', :action => 'recent' # => 'proto://host.com/posts/recent' 529 # url_for :controller => 'posts', :action => 'index' # => 'proto://host.com/posts' 530 # url_for :controller => 'posts', :action => 'show', :id => 10 # => 'proto://host.com/posts/show/10' 531 # url_for :controller => 'posts', :user => 'd', :password => '123' # => 'proto://d:123@host.com/posts' 530 # 531 # url_for :controller => 'posts', :action => 'recent' # => 'proto://host.com/posts/recent' 532 # url_for :controller => 'posts', :action => 'index' # => 'proto://host.com/posts' 533 # url_for :controller => 'posts', :action => 'index', :port=>'8033' # => 'proto://host.com:8033/posts' 534 # url_for :controller => 'posts', :action => 'show', :id => 10 # => 'proto://host.com/posts/show/10' 535 # url_for :controller => 'posts', :user => 'd', :password => '123' # => 'proto://d:123@host.com/posts' 532 536 # 533 537 # When generating a new URL, missing values may be filled in from the current request's parameters. For example, trunk/actionpack/lib/action_controller/url_rewriter.rb
r7186 r7331 27 27 end 28 28 29 # Generate a url with the provided options. The following special options may30 # effect the constructed url:29 # Generate a url based on the options provided, default_url_options and the 30 # routes defined in routes.rb 31 31 # 32 # * :host Specifies the host the link should be targetted at. This option 33 # must be provided either explicitly, or via default_url_options. 34 # * :protocol The protocol to connect to. Defaults to 'http' 35 # * :port Optionally specify the port to connect to. 32 # Options used by <tt>url_for</tt>: 33 # 34 # * <tt>:only_path</tt> If true, the relative url is returned. Defaults to false. 35 # * <tt>:protocol</tt> The protocol to connect to. Defaults to 'http'. 36 # * <tt>:host</tt> Specifies the host the link should be targetted at. If <tt>:only_path</tt> is false, this option must be 37 # provided either explicitly, or via default_url_options. 38 # * <tt>:port</tt> Optionally specify the port to connect to. 39 # * <tt>:anchor</tt> An anchor name to be appended to the path. 40 # 41 # Any other key(:controller, :action, etc...) given to <tt>url_for</tt> is forwarded to the Routes module. 42 # 43 # Examples: 44 # 45 # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :port=>'8080' # => 'http://somehost.org:8080/tasks/testing' 46 # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok' 47 # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :number => '33' # => 'http://somehost.org/tasks/testing?number=33' 48 # 36 49 def url_for(options) 37 50 options = self.class.default_url_options.merge(options)