actionpack 7.1.3 → 7.2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -501
  3. data/lib/abstract_controller/asset_paths.rb +2 -0
  4. data/lib/abstract_controller/base.rb +102 -98
  5. data/lib/abstract_controller/caching/fragments.rb +50 -53
  6. data/lib/abstract_controller/caching.rb +2 -0
  7. data/lib/abstract_controller/callbacks.rb +66 -64
  8. data/lib/abstract_controller/collector.rb +6 -6
  9. data/lib/abstract_controller/deprecator.rb +2 -0
  10. data/lib/abstract_controller/error.rb +2 -0
  11. data/lib/abstract_controller/helpers.rb +70 -85
  12. data/lib/abstract_controller/logger.rb +2 -0
  13. data/lib/abstract_controller/railties/routes_helpers.rb +2 -0
  14. data/lib/abstract_controller/rendering.rb +13 -12
  15. data/lib/abstract_controller/translation.rb +15 -7
  16. data/lib/abstract_controller/url_for.rb +8 -6
  17. data/lib/abstract_controller.rb +2 -0
  18. data/lib/action_controller/api/api_rendering.rb +2 -0
  19. data/lib/action_controller/api.rb +74 -72
  20. data/lib/action_controller/base.rb +198 -126
  21. data/lib/action_controller/caching.rb +15 -12
  22. data/lib/action_controller/deprecator.rb +2 -0
  23. data/lib/action_controller/form_builder.rb +20 -17
  24. data/lib/action_controller/log_subscriber.rb +3 -1
  25. data/lib/action_controller/metal/allow_browser.rb +123 -0
  26. data/lib/action_controller/metal/basic_implicit_render.rb +2 -0
  27. data/lib/action_controller/metal/conditional_get.rb +188 -174
  28. data/lib/action_controller/metal/content_security_policy.rb +25 -24
  29. data/lib/action_controller/metal/cookies.rb +4 -2
  30. data/lib/action_controller/metal/data_streaming.rb +64 -55
  31. data/lib/action_controller/metal/default_headers.rb +5 -3
  32. data/lib/action_controller/metal/etag_with_flash.rb +3 -1
  33. data/lib/action_controller/metal/etag_with_template_digest.rb +17 -15
  34. data/lib/action_controller/metal/exceptions.rb +11 -9
  35. data/lib/action_controller/metal/flash.rb +12 -10
  36. data/lib/action_controller/metal/head.rb +12 -10
  37. data/lib/action_controller/metal/helpers.rb +63 -55
  38. data/lib/action_controller/metal/http_authentication.rb +210 -205
  39. data/lib/action_controller/metal/implicit_render.rb +17 -15
  40. data/lib/action_controller/metal/instrumentation.rb +15 -12
  41. data/lib/action_controller/metal/live.rb +113 -107
  42. data/lib/action_controller/metal/logging.rb +6 -4
  43. data/lib/action_controller/metal/mime_responds.rb +151 -142
  44. data/lib/action_controller/metal/parameter_encoding.rb +34 -32
  45. data/lib/action_controller/metal/params_wrapper.rb +57 -59
  46. data/lib/action_controller/metal/permissions_policy.rb +13 -12
  47. data/lib/action_controller/metal/rate_limiting.rb +62 -0
  48. data/lib/action_controller/metal/redirecting.rb +108 -82
  49. data/lib/action_controller/metal/renderers.rb +50 -49
  50. data/lib/action_controller/metal/rendering.rb +103 -75
  51. data/lib/action_controller/metal/request_forgery_protection.rb +162 -133
  52. data/lib/action_controller/metal/rescue.rb +11 -9
  53. data/lib/action_controller/metal/streaming.rb +138 -136
  54. data/lib/action_controller/metal/strong_parameters.rb +525 -480
  55. data/lib/action_controller/metal/testing.rb +2 -0
  56. data/lib/action_controller/metal/url_for.rb +17 -15
  57. data/lib/action_controller/metal.rb +86 -60
  58. data/lib/action_controller/railtie.rb +3 -0
  59. data/lib/action_controller/railties/helpers.rb +2 -0
  60. data/lib/action_controller/renderer.rb +42 -36
  61. data/lib/action_controller/template_assertions.rb +4 -2
  62. data/lib/action_controller/test_case.rb +146 -126
  63. data/lib/action_controller.rb +10 -3
  64. data/lib/action_dispatch/constants.rb +2 -0
  65. data/lib/action_dispatch/deprecator.rb +2 -0
  66. data/lib/action_dispatch/http/cache.rb +27 -26
  67. data/lib/action_dispatch/http/content_disposition.rb +2 -0
  68. data/lib/action_dispatch/http/content_security_policy.rb +44 -38
  69. data/lib/action_dispatch/http/filter_parameters.rb +18 -9
  70. data/lib/action_dispatch/http/filter_redirect.rb +22 -1
  71. data/lib/action_dispatch/http/headers.rb +22 -22
  72. data/lib/action_dispatch/http/mime_negotiation.rb +30 -41
  73. data/lib/action_dispatch/http/mime_type.rb +31 -24
  74. data/lib/action_dispatch/http/mime_types.rb +2 -0
  75. data/lib/action_dispatch/http/parameters.rb +11 -9
  76. data/lib/action_dispatch/http/permissions_policy.rb +20 -44
  77. data/lib/action_dispatch/http/rack_cache.rb +2 -0
  78. data/lib/action_dispatch/http/request.rb +94 -75
  79. data/lib/action_dispatch/http/response.rb +73 -61
  80. data/lib/action_dispatch/http/upload.rb +18 -16
  81. data/lib/action_dispatch/http/url.rb +75 -73
  82. data/lib/action_dispatch/journey/formatter.rb +13 -6
  83. data/lib/action_dispatch/journey/gtg/builder.rb +4 -3
  84. data/lib/action_dispatch/journey/gtg/simulator.rb +2 -0
  85. data/lib/action_dispatch/journey/gtg/transition_table.rb +10 -8
  86. data/lib/action_dispatch/journey/nfa/dot.rb +2 -0
  87. data/lib/action_dispatch/journey/nodes/node.rb +6 -5
  88. data/lib/action_dispatch/journey/parser.rb +4 -3
  89. data/lib/action_dispatch/journey/parser_extras.rb +2 -0
  90. data/lib/action_dispatch/journey/path/pattern.rb +4 -1
  91. data/lib/action_dispatch/journey/route.rb +9 -7
  92. data/lib/action_dispatch/journey/router/utils.rb +16 -15
  93. data/lib/action_dispatch/journey/router.rb +4 -2
  94. data/lib/action_dispatch/journey/routes.rb +4 -2
  95. data/lib/action_dispatch/journey/scanner.rb +4 -2
  96. data/lib/action_dispatch/journey/visitors.rb +2 -0
  97. data/lib/action_dispatch/journey.rb +2 -0
  98. data/lib/action_dispatch/log_subscriber.rb +2 -0
  99. data/lib/action_dispatch/middleware/actionable_exceptions.rb +2 -0
  100. data/lib/action_dispatch/middleware/assume_ssl.rb +8 -5
  101. data/lib/action_dispatch/middleware/callbacks.rb +3 -1
  102. data/lib/action_dispatch/middleware/cookies.rb +119 -104
  103. data/lib/action_dispatch/middleware/debug_exceptions.rb +13 -5
  104. data/lib/action_dispatch/middleware/debug_locks.rb +15 -13
  105. data/lib/action_dispatch/middleware/debug_view.rb +2 -0
  106. data/lib/action_dispatch/middleware/exception_wrapper.rb +6 -11
  107. data/lib/action_dispatch/middleware/executor.rb +8 -0
  108. data/lib/action_dispatch/middleware/flash.rb +63 -51
  109. data/lib/action_dispatch/middleware/host_authorization.rb +17 -15
  110. data/lib/action_dispatch/middleware/public_exceptions.rb +8 -6
  111. data/lib/action_dispatch/middleware/reloader.rb +5 -3
  112. data/lib/action_dispatch/middleware/remote_ip.rb +77 -72
  113. data/lib/action_dispatch/middleware/request_id.rb +14 -9
  114. data/lib/action_dispatch/middleware/server_timing.rb +4 -2
  115. data/lib/action_dispatch/middleware/session/abstract_store.rb +2 -0
  116. data/lib/action_dispatch/middleware/session/cache_store.rb +13 -8
  117. data/lib/action_dispatch/middleware/session/cookie_store.rb +27 -26
  118. data/lib/action_dispatch/middleware/session/mem_cache_store.rb +7 -3
  119. data/lib/action_dispatch/middleware/show_exceptions.rb +31 -21
  120. data/lib/action_dispatch/middleware/ssl.rb +43 -40
  121. data/lib/action_dispatch/middleware/stack.rb +11 -10
  122. data/lib/action_dispatch/middleware/static.rb +33 -31
  123. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +1 -1
  124. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +1 -1
  125. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +1 -1
  126. data/lib/action_dispatch/railtie.rb +2 -4
  127. data/lib/action_dispatch/request/session.rb +23 -21
  128. data/lib/action_dispatch/request/utils.rb +2 -0
  129. data/lib/action_dispatch/routing/endpoint.rb +2 -0
  130. data/lib/action_dispatch/routing/inspector.rb +5 -3
  131. data/lib/action_dispatch/routing/mapper.rb +671 -636
  132. data/lib/action_dispatch/routing/polymorphic_routes.rb +69 -62
  133. data/lib/action_dispatch/routing/redirection.rb +37 -32
  134. data/lib/action_dispatch/routing/route_set.rb +59 -45
  135. data/lib/action_dispatch/routing/routes_proxy.rb +6 -4
  136. data/lib/action_dispatch/routing/url_for.rb +130 -125
  137. data/lib/action_dispatch/routing.rb +150 -148
  138. data/lib/action_dispatch/system_test_case.rb +91 -81
  139. data/lib/action_dispatch/system_testing/browser.rb +10 -3
  140. data/lib/action_dispatch/system_testing/driver.rb +3 -1
  141. data/lib/action_dispatch/system_testing/server.rb +2 -0
  142. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +32 -21
  143. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +2 -0
  144. data/lib/action_dispatch/testing/assertion_response.rb +8 -6
  145. data/lib/action_dispatch/testing/assertions/response.rb +26 -23
  146. data/lib/action_dispatch/testing/assertions/routing.rb +153 -84
  147. data/lib/action_dispatch/testing/assertions.rb +2 -0
  148. data/lib/action_dispatch/testing/integration.rb +223 -222
  149. data/lib/action_dispatch/testing/request_encoder.rb +2 -0
  150. data/lib/action_dispatch/testing/test_helpers/page_dump_helper.rb +35 -0
  151. data/lib/action_dispatch/testing/test_process.rb +12 -8
  152. data/lib/action_dispatch/testing/test_request.rb +3 -1
  153. data/lib/action_dispatch/testing/test_response.rb +27 -26
  154. data/lib/action_dispatch.rb +22 -28
  155. data/lib/action_pack/gem_version.rb +6 -4
  156. data/lib/action_pack/version.rb +3 -1
  157. data/lib/action_pack.rb +17 -16
  158. metadata +39 -16
@@ -1,90 +1,93 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionDispatch
4
6
  module Routing
5
- # = Action Dispatch Routing \UrlFor
7
+ # # Action Dispatch Routing UrlFor
6
8
  #
7
- # In <tt>config/routes.rb</tt> you define URL-to-controller mappings, but the reverse
9
+ # In `config/routes.rb` you define URL-to-controller mappings, but the reverse
8
10
  # is also possible: a URL can be generated from one of your routing definitions.
9
11
  # URL generation functionality is centralized in this module.
10
12
  #
11
- # See ActionDispatch::Routing for general information about routing and <tt>config/routes.rb</tt>.
13
+ # See ActionDispatch::Routing for general information about routing and
14
+ # `config/routes.rb`.
12
15
  #
13
- # <b>Tip:</b> If you need to generate URLs from your models or some other place,
16
+ # **Tip:** If you need to generate URLs from your models or some other place,
14
17
  # then ActionDispatch::Routing::UrlFor is what you're looking for. Read on for
15
- # an introduction. In general, this module should not be included on its own,
16
- # as it is usually included by +url_helpers+ (as in <tt>Rails.application.routes.url_helpers</tt>).
17
- #
18
- # == URL generation from parameters
19
- #
20
- # As you may know, some functions, such as <tt>ActionController::Base#url_for</tt>
21
- # and ActionView::Helpers::UrlHelper#link_to, can generate URLs given a set
22
- # of parameters. For example, you've probably had the chance to write code
23
- # like this in one of your views:
24
- #
25
- # <%= link_to('Click here', controller: 'users',
26
- # action: 'new', message: 'Welcome!') %>
27
- # # => <a href="/users/new?message=Welcome%21">Click here</a>
28
- #
29
- # +link_to+, and all other functions that require URL generation functionality,
30
- # actually use ActionDispatch::Routing::UrlFor under the hood. And in particular,
31
- # they use the ActionDispatch::Routing::UrlFor#url_for method. One can generate
32
- # the same path as the above example by using the following code:
33
- #
34
- # include ActionDispatch::Routing::UrlFor
35
- # url_for(controller: 'users',
36
- # action: 'new',
37
- # message: 'Welcome!',
38
- # only_path: true)
39
- # # => "/users/new?message=Welcome%21"
40
- #
41
- # Notice the <tt>only_path: true</tt> part. This is because UrlFor has no
42
- # information about the website hostname that your \Rails app is serving. So if you
43
- # want to include the hostname as well, then you must also pass the <tt>:host</tt>
44
- # argument:
45
- #
46
- # include UrlFor
47
- # url_for(controller: 'users',
48
- # action: 'new',
49
- # message: 'Welcome!',
50
- # host: 'www.example.com')
51
- # # => "http://www.example.com/users/new?message=Welcome%21"
52
- #
53
- # By default, all controllers and views have access to a special version of +url_for+,
54
- # that already knows what the current hostname is. So if you use +url_for+ in your
55
- # controllers or your views, then you don't need to explicitly pass the <tt>:host</tt>
56
- # argument.
18
+ # an introduction. In general, this module should not be included on its own, as
19
+ # it is usually included by `url_helpers` (as in
20
+ # `Rails.application.routes.url_helpers`).
21
+ #
22
+ # ## URL generation from parameters
23
+ #
24
+ # As you may know, some functions, such as `ActionController::Base#url_for` and
25
+ # ActionView::Helpers::UrlHelper#link_to, can generate URLs given a set of
26
+ # parameters. For example, you've probably had the chance to write code like
27
+ # this in one of your views:
28
+ #
29
+ # <%= link_to('Click here', controller: 'users',
30
+ # action: 'new', message: 'Welcome!') %>
31
+ # # => <a href="/users/new?message=Welcome%21">Click here</a>
32
+ #
33
+ # `link_to`, and all other functions that require URL generation functionality,
34
+ # actually use ActionDispatch::Routing::UrlFor under the hood. And in
35
+ # particular, they use the ActionDispatch::Routing::UrlFor#url_for method. One
36
+ # can generate the same path as the above example by using the following code:
37
+ #
38
+ # include ActionDispatch::Routing::UrlFor
39
+ # url_for(controller: 'users',
40
+ # action: 'new',
41
+ # message: 'Welcome!',
42
+ # only_path: true)
43
+ # # => "/users/new?message=Welcome%21"
44
+ #
45
+ # Notice the `only_path: true` part. This is because UrlFor has no information
46
+ # about the website hostname that your Rails app is serving. So if you want to
47
+ # include the hostname as well, then you must also pass the `:host` argument:
48
+ #
49
+ # include UrlFor
50
+ # url_for(controller: 'users',
51
+ # action: 'new',
52
+ # message: 'Welcome!',
53
+ # host: 'www.example.com')
54
+ # # => "http://www.example.com/users/new?message=Welcome%21"
55
+ #
56
+ # By default, all controllers and views have access to a special version of
57
+ # `url_for`, that already knows what the current hostname is. So if you use
58
+ # `url_for` in your controllers or your views, then you don't need to explicitly
59
+ # pass the `:host` argument.
57
60
  #
58
61
  # For convenience, mailers also include ActionDispatch::Routing::UrlFor. So
59
- # within mailers, you can use url_for. However, mailers cannot access
60
- # incoming web requests in order to derive hostname information, so you have
61
- # to provide the +:host+ option or set the default host using
62
- # +default_url_options+. For more information on url_for in mailers see the
63
- # ActionMailer::Base documentation.
64
- #
62
+ # within mailers, you can use url_for. However, mailers cannot access incoming
63
+ # web requests in order to derive hostname information, so you have to provide
64
+ # the `:host` option or set the default host using `default_url_options`. For
65
+ # more information on url_for in mailers see the ActionMailer::Base
66
+ # documentation.
65
67
  #
66
- # == URL generation for named routes
68
+ # ## URL generation for named routes
67
69
  #
68
70
  # UrlFor also allows one to access methods that have been auto-generated from
69
71
  # named routes. For example, suppose that you have a 'users' resource in your
70
- # <tt>config/routes.rb</tt>:
72
+ # `config/routes.rb`:
71
73
  #
72
- # resources :users
74
+ # resources :users
73
75
  #
74
- # This generates, among other things, the method <tt>users_path</tt>. By default,
75
- # this method is accessible from your controllers, views, and mailers. If you need
76
- # to access this auto-generated method from other places (such as a model), then
77
- # you can do that by including <tt>Rails.application.routes.url_helpers</tt> in your class:
76
+ # This generates, among other things, the method `users_path`. By default, this
77
+ # method is accessible from your controllers, views, and mailers. If you need to
78
+ # access this auto-generated method from other places (such as a model), then
79
+ # you can do that by including `Rails.application.routes.url_helpers` in your
80
+ # class:
78
81
  #
79
- # class User < ActiveRecord::Base
80
- # include Rails.application.routes.url_helpers
82
+ # class User < ActiveRecord::Base
83
+ # include Rails.application.routes.url_helpers
81
84
  #
82
- # def base_uri
83
- # user_path(self)
85
+ # def base_uri
86
+ # user_path(self)
87
+ # end
84
88
  # end
85
- # end
86
89
  #
87
- # User.find(1).base_uri # => "/users/1"
90
+ # User.find(1).base_uri # => "/users/1"
88
91
  #
89
92
  module UrlFor
90
93
  extend ActiveSupport::Concern
@@ -110,66 +113,68 @@ module ActionDispatch
110
113
  super
111
114
  end
112
115
 
113
- # Hook overridden in controller to add request information
114
- # with +default_url_options+. Application logic should not
115
- # go into url_options.
116
+ # Hook overridden in controller to add request information with
117
+ # `default_url_options`. Application logic should not go into url_options.
116
118
  def url_options
117
119
  default_url_options
118
120
  end
119
121
 
120
- # Generate a URL based on the options provided, +default_url_options+, and the
121
- # routes defined in <tt>config/routes.rb</tt>. The following options are supported:
122
+ # Generate a URL based on the options provided, `default_url_options`, and the
123
+ # routes defined in `config/routes.rb`. The following options are supported:
124
+ #
125
+ # * `:only_path` - If true, the relative URL is returned. Defaults to `false`.
126
+ # * `:protocol` - The protocol to connect to. Defaults to `"http"`.
127
+ # * `:host` - Specifies the host the link should be targeted at. If
128
+ # `:only_path` is false, this option must be provided either explicitly, or
129
+ # via `default_url_options`.
130
+ # * `:subdomain` - Specifies the subdomain of the link, using the `tld_length`
131
+ # to split the subdomain from the host. If false, removes all subdomains
132
+ # from the host part of the link.
133
+ # * `:domain` - Specifies the domain of the link, using the `tld_length` to
134
+ # split the domain from the host.
135
+ # * `:tld_length` - Number of labels the TLD id composed of, only used if
136
+ # `:subdomain` or `:domain` are supplied. Defaults to
137
+ # `ActionDispatch::Http::URL.tld_length`, which in turn defaults to 1.
138
+ # * `:port` - Optionally specify the port to connect to.
139
+ # * `:anchor` - An anchor name to be appended to the path.
140
+ # * `:params` - The query parameters to be appended to the path.
141
+ # * `:path_params` - The query parameters that will only be used for the named
142
+ # dynamic segments of path. If unused, they will be discarded.
143
+ # * `:trailing_slash` - If true, adds a trailing slash, as in
144
+ # `"/archive/2009/"`.
145
+ # * `:script_name` - Specifies application path relative to domain root. If
146
+ # provided, prepends application path.
122
147
  #
123
- # * <tt>:only_path</tt> - If true, the relative URL is returned. Defaults to +false+.
124
- # * <tt>:protocol</tt> - The protocol to connect to. Defaults to <tt>"http"</tt>.
125
- # * <tt>:host</tt> - Specifies the host the link should be targeted at.
126
- # If <tt>:only_path</tt> is false, this option must be
127
- # provided either explicitly, or via +default_url_options+.
128
- # * <tt>:subdomain</tt> - Specifies the subdomain of the link, using the +tld_length+
129
- # to split the subdomain from the host.
130
- # If false, removes all subdomains from the host part of the link.
131
- # * <tt>:domain</tt> - Specifies the domain of the link, using the +tld_length+
132
- # to split the domain from the host.
133
- # * <tt>:tld_length</tt> - Number of labels the TLD id composed of, only used if
134
- # <tt>:subdomain</tt> or <tt>:domain</tt> are supplied. Defaults to
135
- # <tt>ActionDispatch::Http::URL.tld_length</tt>, which in turn defaults to 1.
136
- # * <tt>:port</tt> - Optionally specify the port to connect to.
137
- # * <tt>:anchor</tt> - An anchor name to be appended to the path.
138
- # * <tt>:params</tt> - The query parameters to be appended to the path.
139
- # * <tt>:path_params</tt> - The query parameters that will only be used
140
- # for the named dynamic segments of path. If unused, they will be discarded.
141
- # * <tt>:trailing_slash</tt> - If true, adds a trailing slash, as in <tt>"/archive/2009/"</tt>.
142
- # * <tt>:script_name</tt> - Specifies application path relative to domain root. If provided, prepends application path.
143
148
  #
144
- # Any other key (<tt>:controller</tt>, <tt>:action</tt>, etc.) given to
145
- # +url_for+ is forwarded to the Routes module.
149
+ # Any other key (`:controller`, `:action`, etc.) given to `url_for` is forwarded
150
+ # to the Routes module.
146
151
  #
147
- # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', port: '8080'
148
- # # => 'http://somehost.org:8080/tasks/testing'
149
- # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', anchor: 'ok', only_path: true
150
- # # => '/tasks/testing#ok'
151
- # url_for controller: 'tasks', action: 'testing', trailing_slash: true
152
- # # => 'http://somehost.org/tasks/testing/'
153
- # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', number: '33'
154
- # # => 'http://somehost.org/tasks/testing?number=33'
155
- # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp"
156
- # # => 'http://somehost.org/myapp/tasks/testing'
157
- # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp", only_path: true
158
- # # => '/myapp/tasks/testing'
152
+ # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', port: '8080'
153
+ # # => 'http://somehost.org:8080/tasks/testing'
154
+ # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', anchor: 'ok', only_path: true
155
+ # # => '/tasks/testing#ok'
156
+ # url_for controller: 'tasks', action: 'testing', trailing_slash: true
157
+ # # => 'http://somehost.org/tasks/testing/'
158
+ # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', number: '33'
159
+ # # => 'http://somehost.org/tasks/testing?number=33'
160
+ # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp"
161
+ # # => 'http://somehost.org/myapp/tasks/testing'
162
+ # url_for controller: 'tasks', action: 'testing', host: 'somehost.org', script_name: "/myapp", only_path: true
163
+ # # => '/myapp/tasks/testing'
159
164
  #
160
165
  # Missing routes keys may be filled in from the current request's parameters
161
- # (e.g. +:controller+, +:action+, +:id+, and any other parameters that are
162
- # placed in the path). Given that the current action has been reached
163
- # through <tt>GET /users/1</tt>:
166
+ # (e.g. `:controller`, `:action`, `:id`, and any other parameters that are
167
+ # placed in the path). Given that the current action has been reached through
168
+ # `GET /users/1`:
164
169
  #
165
- # url_for(only_path: true) # => '/users/1'
166
- # url_for(only_path: true, action: 'edit') # => '/users/1/edit'
167
- # url_for(only_path: true, action: 'edit', id: 2) # => '/users/2/edit'
170
+ # url_for(only_path: true) # => '/users/1'
171
+ # url_for(only_path: true, action: 'edit') # => '/users/1/edit'
172
+ # url_for(only_path: true, action: 'edit', id: 2) # => '/users/2/edit'
168
173
  #
169
- # Notice that no +:id+ parameter was provided to the first +url_for+ call
170
- # and the helper used the one from the route's path. Any path parameter
171
- # implicitly used by +url_for+ can always be overwritten like shown on the
172
- # last +url_for+ calls.
174
+ # Notice that no `:id` parameter was provided to the first `url_for` call and
175
+ # the helper used the one from the route's path. Any path parameter implicitly
176
+ # used by `url_for` can always be overwritten like shown on the last `url_for`
177
+ # calls.
173
178
  def url_for(options = nil)
174
179
  full_url_for(options)
175
180
  end
@@ -198,21 +203,21 @@ module ActionDispatch
198
203
 
199
204
  # Allows calling direct or regular named route.
200
205
  #
201
- # resources :buckets
206
+ # resources :buckets
202
207
  #
203
- # direct :recordable do |recording|
204
- # route_for(:bucket, recording.bucket)
205
- # end
208
+ # direct :recordable do |recording|
209
+ # route_for(:bucket, recording.bucket)
210
+ # end
206
211
  #
207
- # direct :threadable do |threadable|
208
- # route_for(:recordable, threadable.parent)
209
- # end
212
+ # direct :threadable do |threadable|
213
+ # route_for(:recordable, threadable.parent)
214
+ # end
210
215
  #
211
- # This maintains the context of the original caller on
212
- # whether to return a path or full URL, e.g:
216
+ # This maintains the context of the original caller on whether to return a path
217
+ # or full URL, e.g:
213
218
  #
214
- # threadable_path(threadable) # => "/buckets/1"
215
- # threadable_url(threadable) # => "http://example.com/buckets/1"
219
+ # threadable_path(threadable) # => "/buckets/1"
220
+ # threadable_url(threadable) # => "http://example.com/buckets/1"
216
221
  #
217
222
  def route_for(name, *args)
218
223
  public_send(:"#{name}_url", *args)