diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-08-17 01:08:16 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-08-17 01:08:16 +0000 |
commit | 3280a6e51b6359095000d810c9fe2d3d8c6ac352 (patch) | |
tree | 81729cd553fa3e1bcbebc1d5175fc3a28076f536 /actionpack/lib/action_controller/url_rewriter.rb | |
parent | 29b0707f07f148d98515125dab44b73cfdc0a3d4 (diff) | |
download | rails-3280a6e51b6359095000d810c9fe2d3d8c6ac352.tar.gz rails-3280a6e51b6359095000d810c9fe2d3d8c6ac352.tar.bz2 rails-3280a6e51b6359095000d810c9fe2d3d8c6ac352.zip |
Improve url_for documentation for ActionController::Base and UrlRewriter. Closes #9022. Closes #9077. [juanjo.bazan]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7331 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/url_rewriter.rb')
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 3b2af2e1c2..0ed6e4de7d 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -26,13 +26,26 @@ module ActionController base.default_url_options ||= default_url_options end - # Generate a url with the provided options. The following special options may - # effect the constructed url: + # Generate a url based on the options provided, default_url_options and the + # routes defined in routes.rb + # + # Options used by <tt>url_for</tt>: + # + # * <tt>:only_path</tt> If true, the relative url is returned. Defaults to false. + # * <tt>:protocol</tt> The protocol to connect to. Defaults to 'http'. + # * <tt>:host</tt> Specifies the host the link should be targetted at. If <tt>:only_path</tt> is false, this option must be + # provided either explicitly, or via default_url_options. + # * <tt>:port</tt> Optionally specify the port to connect to. + # * <tt>:anchor</tt> An anchor name to be appended to the path. + # + # Any other key(:controller, :action, etc...) given to <tt>url_for</tt> is forwarded to the Routes module. + # + # Examples: + # + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :port=>'8080' # => 'http://somehost.org:8080/tasks/testing' + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok' + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :number => '33' # => 'http://somehost.org/tasks/testing?number=33' # - # * :host Specifies the host the link should be targetted at. This option - # must be provided either explicitly, or via default_url_options. - # * :protocol The protocol to connect to. Defaults to 'http' - # * :port Optionally specify the port to connect to. def url_for(options) options = self.class.default_url_options.merge(options) |