aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/url_for.rb
diff options
context:
space:
mode:
authorIvan Vanyak <vvanyak@gmail.com>2012-12-17 14:12:24 +1100
committerIvan Vanyak <vvanyak@gmail.com>2012-12-17 14:15:01 +1100
commit0c181b4b70a703436e608c38fc02cf31db7c915c (patch)
tree2c07058741789bba0bc45303c3f73cbb07de4d6e /actionpack/lib/action_dispatch/routing/url_for.rb
parent5cc178a291a363a4c6b15fd826a7551a23a87786 (diff)
downloadrails-0c181b4b70a703436e608c38fc02cf31db7c915c.tar.gz
rails-0c181b4b70a703436e608c38fc02cf31db7c915c.tar.bz2
rails-0c181b4b70a703436e608c38fc02cf31db7c915c.zip
Add script_name option description and example for #url_for options
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/url_for.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/url_for.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb
index 76311c423a..8e19025722 100644
--- a/actionpack/lib/action_dispatch/routing/url_for.rb
+++ b/actionpack/lib/action_dispatch/routing/url_for.rb
@@ -130,6 +130,7 @@ module ActionDispatch
# * <tt>:port</tt> - Optionally specify the port to connect to.
# * <tt>:anchor</tt> - An anchor name to be appended to the path.
# * <tt>:trailing_slash</tt> - If true, adds a trailing slash, as in "/archive/2009/"
+ # * <tt>:script_name</tt> - Specifies application path relative to domain root. If provided, prepends application path.
#
# Any other key (<tt>:controller</tt>, <tt>:action</tt>, etc.) given to
# +url_for+ is forwarded to the Routes module.
@@ -142,6 +143,10 @@ module ActionDispatch
# # => 'http://somehost.org/tasks/testing/'
# url_for controller: 'tasks', action: 'testing', host: 'somehost.org', number: '33'
# # => 'http://somehost.org/tasks/testing?number=33'
+ # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp"
+ # # => 'http://somehost.org/myapp/tasks/testing'
+ # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp", only_path: true
+ # # => '/myapp/tasks/testing'
def url_for(options = nil)
case options
when nil