actionpack 4.1.16 → 4.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +163 -690
  3. data/README.rdoc +7 -2
  4. data/lib/abstract_controller/base.rb +16 -6
  5. data/lib/abstract_controller/callbacks.rb +28 -51
  6. data/lib/abstract_controller/helpers.rb +0 -3
  7. data/lib/abstract_controller/railties/routes_helpers.rb +3 -3
  8. data/lib/abstract_controller/rendering.rb +1 -7
  9. data/lib/abstract_controller/url_for.rb +1 -1
  10. data/lib/action_controller.rb +1 -0
  11. data/lib/action_controller/base.rb +2 -1
  12. data/lib/action_controller/caching.rb +1 -1
  13. data/lib/action_controller/caching/fragments.rb +7 -1
  14. data/lib/action_controller/log_subscriber.rb +26 -25
  15. data/lib/action_controller/metal.rb +11 -7
  16. data/lib/action_controller/metal/conditional_get.rb +31 -6
  17. data/lib/action_controller/metal/etag_with_template_digest.rb +50 -0
  18. data/lib/action_controller/metal/force_ssl.rb +1 -1
  19. data/lib/action_controller/metal/head.rb +2 -0
  20. data/lib/action_controller/metal/http_authentication.rb +3 -15
  21. data/lib/action_controller/metal/instrumentation.rb +4 -7
  22. data/lib/action_controller/metal/live.rb +57 -6
  23. data/lib/action_controller/metal/mime_responds.rb +17 -227
  24. data/lib/action_controller/metal/redirecting.rb +14 -8
  25. data/lib/action_controller/metal/renderers.rb +19 -3
  26. data/lib/action_controller/metal/rendering.rb +2 -6
  27. data/lib/action_controller/metal/request_forgery_protection.rb +75 -7
  28. data/lib/action_controller/metal/streaming.rb +1 -1
  29. data/lib/action_controller/metal/strong_parameters.rb +111 -11
  30. data/lib/action_controller/metal/url_for.rb +11 -12
  31. data/lib/action_controller/model_naming.rb +1 -1
  32. data/lib/action_controller/railtie.rb +4 -0
  33. data/lib/action_controller/test_case.rb +87 -75
  34. data/lib/action_dispatch/http/cache.rb +1 -1
  35. data/lib/action_dispatch/http/filter_parameters.rb +2 -2
  36. data/lib/action_dispatch/http/headers.rb +43 -9
  37. data/lib/action_dispatch/http/mime_negotiation.rb +10 -4
  38. data/lib/action_dispatch/http/mime_type.rb +2 -16
  39. data/lib/action_dispatch/http/parameter_filter.rb +1 -1
  40. data/lib/action_dispatch/http/parameters.rb +11 -26
  41. data/lib/action_dispatch/http/request.rb +30 -10
  42. data/lib/action_dispatch/http/response.rb +52 -17
  43. data/lib/action_dispatch/http/upload.rb +3 -8
  44. data/lib/action_dispatch/http/url.rb +87 -70
  45. data/lib/action_dispatch/journey/formatter.rb +18 -17
  46. data/lib/action_dispatch/journey/gtg/builder.rb +3 -3
  47. data/lib/action_dispatch/journey/gtg/simulator.rb +10 -7
  48. data/lib/action_dispatch/journey/gtg/transition_table.rb +18 -26
  49. data/lib/action_dispatch/journey/nfa/dot.rb +2 -2
  50. data/lib/action_dispatch/journey/nfa/simulator.rb +1 -1
  51. data/lib/action_dispatch/journey/nfa/transition_table.rb +5 -5
  52. data/lib/action_dispatch/journey/nodes/node.rb +4 -0
  53. data/lib/action_dispatch/journey/parser.rb +52 -60
  54. data/lib/action_dispatch/journey/parser.y +11 -10
  55. data/lib/action_dispatch/journey/path/pattern.rb +16 -19
  56. data/lib/action_dispatch/journey/route.rb +3 -18
  57. data/lib/action_dispatch/journey/router.rb +34 -65
  58. data/lib/action_dispatch/journey/router/strexp.rb +9 -6
  59. data/lib/action_dispatch/journey/routes.rb +0 -4
  60. data/lib/action_dispatch/journey/visitors.rb +81 -92
  61. data/lib/action_dispatch/journey/visualizer/index.html.erb +2 -2
  62. data/lib/action_dispatch/middleware/cookies.rb +27 -31
  63. data/lib/action_dispatch/middleware/debug_exceptions.rb +32 -3
  64. data/lib/action_dispatch/middleware/exception_wrapper.rb +19 -17
  65. data/lib/action_dispatch/middleware/flash.rb +7 -4
  66. data/lib/action_dispatch/middleware/public_exceptions.rb +13 -8
  67. data/lib/action_dispatch/middleware/remote_ip.rb +3 -3
  68. data/lib/action_dispatch/middleware/request_id.rb +1 -1
  69. data/lib/action_dispatch/middleware/session/cookie_store.rb +1 -1
  70. data/lib/action_dispatch/middleware/show_exceptions.rb +1 -0
  71. data/lib/action_dispatch/middleware/static.rb +22 -23
  72. data/lib/action_dispatch/middleware/templates/rescues/_source.erb +22 -18
  73. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +36 -8
  74. data/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb +2 -8
  75. data/lib/action_dispatch/middleware/templates/rescues/{diagnostics.erb → diagnostics.html.erb} +0 -0
  76. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +9 -0
  77. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +6 -0
  78. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -24
  79. data/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +0 -1
  80. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +119 -63
  81. data/lib/action_dispatch/routing/endpoint.rb +10 -0
  82. data/lib/action_dispatch/routing/inspector.rb +4 -11
  83. data/lib/action_dispatch/routing/mapper.rb +399 -278
  84. data/lib/action_dispatch/routing/polymorphic_routes.rb +190 -78
  85. data/lib/action_dispatch/routing/redirection.rb +10 -12
  86. data/lib/action_dispatch/routing/route_set.rb +224 -177
  87. data/lib/action_dispatch/routing/url_for.rb +9 -4
  88. data/lib/action_dispatch/testing/assertions.rb +11 -7
  89. data/lib/action_dispatch/testing/assertions/dom.rb +2 -26
  90. data/lib/action_dispatch/testing/assertions/response.rb +2 -7
  91. data/lib/action_dispatch/testing/assertions/routing.rb +9 -9
  92. data/lib/action_dispatch/testing/assertions/selector.rb +2 -429
  93. data/lib/action_dispatch/testing/assertions/tag.rb +2 -134
  94. data/lib/action_dispatch/testing/integration.rb +15 -18
  95. data/lib/action_dispatch/testing/test_request.rb +1 -1
  96. data/lib/action_dispatch/testing/test_response.rb +5 -1
  97. data/lib/action_pack/gem_version.rb +3 -3
  98. metadata +57 -15
  99. data/lib/action_controller/metal/responder.rb +0 -297
@@ -1,25 +1,29 @@
1
1
  <% if @source_extract %>
2
- <div class="source">
3
- <div class="info">
4
- Extracted source (around line <strong>#<%= @line_number %></strong>):
5
- </div>
6
- <div class="data">
7
- <table cellpadding="0" cellspacing="0" class="lines">
8
- <tr>
9
- <td>
10
- <pre class="line_numbers">
11
- <% @source_extract.keys.each do |line_number| %>
2
+ <% @source_extract.each_with_index do |extract_source, index| %>
3
+ <% if extract_source[:code] %>
4
+ <div class="source <%="hidden" if index != 0%>" id="frame-source-<%=index%>">
5
+ <div class="info">
6
+ Extracted source (around line <strong>#<%= extract_source[:line_number] %></strong>):
7
+ </div>
8
+ <div class="data">
9
+ <table cellpadding="0" cellspacing="0" class="lines">
10
+ <tr>
11
+ <td>
12
+ <pre class="line_numbers">
13
+ <% extract_source[:code].keys.each do |line_number| %>
12
14
  <span><%= line_number -%></span>
13
- <% end %>
14
- </pre>
15
- </td>
15
+ <% end %>
16
+ </pre>
17
+ </td>
16
18
  <td width="100%">
17
19
  <pre>
18
- <% @source_extract.each do |line, source| -%><div class="line<%= " active" if line == @line_number -%>"><%= source -%></div><% end -%>
20
+ <% extract_source[:code].each do |line, source| -%><div class="line<%= " active" if line == extract_source[:line_number] -%>"><%= source -%></div><% end -%>
19
21
  </pre>
20
22
  </td>
21
- </tr>
22
- </table>
23
- </div>
24
- </div>
23
+ </tr>
24
+ </table>
25
+ </div>
26
+ </div>
27
+ <% end %>
28
+ <% end %>
25
29
  <% end %>
@@ -1,9 +1,4 @@
1
- <%
2
- traces = { "Application Trace" => @application_trace,
3
- "Framework Trace" => @framework_trace,
4
- "Full Trace" => @full_trace }
5
- names = traces.keys
6
- %>
1
+ <% names = @traces.keys %>
7
2
 
8
3
  <p><code>Rails.root: <%= defined?(Rails) && Rails.respond_to?(:root) ? Rails.root : "unset" %></code></p>
9
4
 
@@ -16,9 +11,42 @@
16
11
  <a href="#" onclick="<%= hide.join %><%= show %>; return false;"><%= name %></a> <%= '|' unless names.last == name %>
17
12
  <% end %>
18
13
 
19
- <% traces.each do |name, trace| %>
14
+ <% @traces.each do |name, trace| %>
20
15
  <div id="<%= name.gsub(/\s/, '-') %>" style="display: <%= (name == "Application Trace") ? 'block' : 'none' %>;">
21
- <pre><code><%= trace.join "\n" %></code></pre>
16
+ <pre><code><% trace.each do |frame| %><a class="trace-frames" data-frame-id="<%= frame[:id] %>" href="#"><%= frame[:trace] %></a><br><% end %></code></pre>
22
17
  </div>
23
18
  <% end %>
19
+
20
+ <script type="text/javascript">
21
+ var traceFrames = document.getElementsByClassName('trace-frames');
22
+ var selectedFrame, currentSource = document.getElementById('frame-source-0');
23
+
24
+ // Add click listeners for all stack frames
25
+ for (var i = 0; i < traceFrames.length; i++) {
26
+ traceFrames[i].addEventListener('click', function(e) {
27
+ e.preventDefault();
28
+ var target = e.target;
29
+ var frame_id = target.dataset.frameId;
30
+
31
+ if (selectedFrame) {
32
+ selectedFrame.className = selectedFrame.className.replace("selected", "");
33
+ }
34
+
35
+ target.className += " selected";
36
+ selectedFrame = target;
37
+
38
+ // Change the extracted source code
39
+ changeSourceExtract(frame_id);
40
+ });
41
+
42
+ function changeSourceExtract(frame_id) {
43
+ var el = document.getElementById('frame-source-' + frame_id);
44
+ if (currentSource && el) {
45
+ currentSource.className += " hidden";
46
+ el.className = el.className.replace(" hidden", "");
47
+ currentSource = el;
48
+ }
49
+ }
50
+ }
51
+ </script>
24
52
  </div>
@@ -1,15 +1,9 @@
1
- <%
2
- traces = { "Application Trace" => @application_trace,
3
- "Framework Trace" => @framework_trace,
4
- "Full Trace" => @full_trace }
5
- %>
6
-
7
1
  Rails.root: <%= defined?(Rails) && Rails.respond_to?(:root) ? Rails.root : "unset" %>
8
2
 
9
- <% traces.each do |name, trace| %>
3
+ <% @traces.each do |name, trace| %>
10
4
  <% if trace.any? %>
11
5
  <%= name %>
12
- <%= trace.join("\n") %>
6
+ <%= trace.map { |t| t[:trace] }.join("\n") %>
13
7
 
14
8
  <% end %>
15
9
  <% end %>
@@ -0,0 +1,9 @@
1
+ <%= @exception.class.to_s %><%
2
+ if @request.parameters['controller']
3
+ %> in <%= @request.parameters['controller'].camelize %>Controller<% if @request.parameters['action'] %>#<%= @request.parameters['action'] %><% end %>
4
+ <% end %>
5
+
6
+ <%= @exception.message %>
7
+ <%= render template: "rescues/_source" %>
8
+ <%= render template: "rescues/_trace" %>
9
+ <%= render template: "rescues/_request_and_response" %>
@@ -116,9 +116,15 @@
116
116
  background-color: #FFCCCC;
117
117
  }
118
118
 
119
+ .hidden {
120
+ display: none;
121
+ }
122
+
119
123
  a { color: #980905; }
120
124
  a:visited { color: #666; }
125
+ a.trace-frames { color: #666; }
121
126
  a:hover { color: #C52F24; }
127
+ a.trace-frames.selected { color: #C52F24 }
122
128
 
123
129
  <%= yield :style %>
124
130
  </style>
@@ -1,4 +1,3 @@
1
- <% @source_extract = @exception.source_extract(0, :html) %>
2
1
  <header>
3
2
  <h1>
4
3
  <%= @exception.original_exception.class.to_s %> in
@@ -12,29 +11,7 @@
12
11
  </p>
13
12
  <pre><code><%= h @exception.message %></code></pre>
14
13
 
15
- <div class="source">
16
- <div class="info">
17
- <p>Extracted source (around line <strong>#<%= @exception.line_number %></strong>):</p>
18
- </div>
19
- <div class="data">
20
- <table cellpadding="0" cellspacing="0" class="lines">
21
- <tr>
22
- <td>
23
- <pre class="line_numbers">
24
- <% @source_extract.keys.each do |line_number| %>
25
- <span><%= line_number -%></span>
26
- <% end %>
27
- </pre>
28
- </td>
29
- <td width="100%">
30
- <pre>
31
- <% @source_extract.each do |line, source| -%><div class="line<%= " active" if line == @exception.line_number -%>"><%= source -%></div><% end -%>
32
- </pre>
33
- </td>
34
- </tr>
35
- </table>
36
- </div>
37
- </div>
14
+ <%= render template: "rescues/_source" %>
38
15
 
39
16
  <p><%= @exception.sub_template_message %></p>
40
17
 
@@ -1,4 +1,3 @@
1
- <% @source_extract = @exception.source_extract(0, :html) %>
2
1
  <%= @exception.original_exception.class.to_s %> in <%= @request.parameters["controller"].camelize if @request.parameters["controller"] %>#<%= @request.parameters["action"] %>
3
2
 
4
3
  Showing <%= @exception.file_name %> where line #<%= @exception.line_number %> raised:
@@ -4,21 +4,41 @@
4
4
  border-collapse: collapse;
5
5
  }
6
6
 
7
- #route_table td {
8
- padding: 0 30px;
7
+ #route_table thead tr {
8
+ border-bottom: 2px solid #ddd;
9
+ }
10
+
11
+ #route_table thead tr.bottom {
12
+ border-bottom: none;
9
13
  }
10
14
 
11
- #route_table tr.bottom th {
12
- padding-bottom: 10px;
15
+ #route_table thead tr.bottom th {
16
+ padding: 10px 0;
13
17
  line-height: 15px;
14
18
  }
15
19
 
16
- #route_table .matched_paths {
20
+ #route_table tbody tr {
21
+ border-bottom: 1px solid #ddd;
22
+ }
23
+
24
+ #route_table tbody tr:nth-child(odd) {
25
+ background: #f2f2f2;
26
+ }
27
+
28
+ #route_table tbody.exact_matches,
29
+ #route_table tbody.fuzzy_matches {
17
30
  background-color: LightGoldenRodYellow;
31
+ border-bottom: solid 2px SlateGrey;
18
32
  }
19
33
 
20
- #route_table .matched_paths {
21
- border-bottom: solid 3px SlateGrey;
34
+ #route_table tbody.exact_matches tr,
35
+ #route_table tbody.fuzzy_matches tr {
36
+ background: none;
37
+ border-bottom: none;
38
+ }
39
+
40
+ #route_table td {
41
+ padding: 4px 30px;
22
42
  }
23
43
 
24
44
  #path_search {
@@ -45,13 +65,15 @@
45
65
  <th><%# HTTP Verb %>
46
66
  </th>
47
67
  <th><%# Path %>
48
- <%= search_field(:path, nil, id: 'path_search', placeholder: "Path Match") %>
68
+ <%= search_field(:path, nil, id: 'search', placeholder: "Path Match") %>
49
69
  </th>
50
70
  <th><%# Controller#action %>
51
71
  </th>
52
72
  </tr>
53
73
  </thead>
54
- <tbody class='matched_paths' id='matched_paths'>
74
+ <tbody class='exact_matches' id='exact_matches'>
75
+ </tbody>
76
+ <tbody class='fuzzy_matches' id='fuzzy_matches'>
55
77
  </tbody>
56
78
  <tbody>
57
79
  <%= yield %>
@@ -59,6 +81,7 @@
59
81
  </table>
60
82
 
61
83
  <script type='text/javascript'>
84
+ // Iterates each element through a function
62
85
  function each(elems, func) {
63
86
  if (!elems instanceof Array) { elems = [elems]; }
64
87
  for (var i = 0, len = elems.length; i < len; i++) {
@@ -66,77 +89,110 @@
66
89
  }
67
90
  }
68
91
 
69
- function setValOn(elems, val) {
70
- each(elems, function(elem) {
71
- elem.innerHTML = val;
72
- });
92
+ // Sets innerHTML for an element
93
+ function setContent(elem, text) {
94
+ elem.innerHTML = text;
73
95
  }
74
96
 
75
- function onClick(elems, func) {
76
- each(elems, function(elem) {
77
- elem.onclick = func;
78
- });
79
- }
97
+ // Enables path search functionality
98
+ function setupMatchPaths() {
99
+ // Check if the user input (sanitized as a path) matches the regexp data attribute
100
+ function checkExactMatch(section, elem, value) {
101
+ var string = sanitizePath(value),
102
+ regexp = elem.getAttribute("data-regexp");
80
103
 
81
- // Enables functionality to toggle between `_path` and `_url` helper suffixes
82
- function setupRouteToggleHelperLinks() {
83
- var toggleLinks = document.querySelectorAll('#route_table [data-route-helper]');
84
- onClick(toggleLinks, function(){
85
- var helperTxt = this.getAttribute("data-route-helper"),
86
- helperElems = document.querySelectorAll('[data-route-name] span.helper');
87
- setValOn(helperElems, helperTxt);
88
- });
89
- }
104
+ showMatch(string, regexp, section, elem);
105
+ }
90
106
 
91
- // takes an array of elements with a data-regexp attribute and
92
- // passes their parent <tr> into the callback function
93
- // if the regexp matches a given path
94
- function eachElemsForPath(elems, path, func) {
95
- each(elems, function(e){
96
- var reg = e.getAttribute("data-regexp");
97
- if (path.match(RegExp(reg))) {
98
- func(e.parentNode.cloneNode(true));
99
- }
100
- })
101
- }
107
+ // Check if the route path data attribute contains the user input
108
+ function checkFuzzyMatch(section, elem, value) {
109
+ var string = elem.getAttribute("data-route-path"),
110
+ regexp = value;
102
111
 
103
- // Ensure path always starts with a slash "/" and remove params or fragments
104
- function sanitizePath(path) {
105
- var path = path.charAt(0) == '/' ? path : "/" + path;
106
- return path.replace(/\#.*|\?.*/, '');
107
- }
112
+ showMatch(string, regexp, section, elem);
113
+ }
108
114
 
109
- // Enables path search functionality
110
- function setupMatchPaths() {
111
- var regexpElems = document.querySelectorAll('#route_table [data-regexp]'),
112
- pathElem = document.querySelector('#path_search'),
113
- selectedSection = document.querySelector('#matched_paths'),
114
- noMatchText = '<tr><th colspan="4">None</th></tr>';
115
+ // Display the parent <tr> element in the appropriate section when there's a match
116
+ function showMatch(string, regexp, section, elem) {
117
+ if(string.match(RegExp(regexp))) {
118
+ section.appendChild(elem.parentNode.cloneNode(true));
119
+ }
120
+ }
121
+
122
+ // Check if there are any matched results in a section
123
+ function checkNoMatch(section, defaultText, noMatchText) {
124
+ if (section.innerHTML === defaultText) {
125
+ setContent(section, defaultText + noMatchText);
126
+ }
127
+ }
115
128
 
129
+ // Ensure path always starts with a slash "/" and remove params or fragments
130
+ function sanitizePath(path) {
131
+ var path = path.charAt(0) == '/' ? path : "/" + path;
132
+ return path.replace(/\#.*|\?.*/, '');
133
+ }
116
134
 
117
- // Remove matches if no path is present
118
- pathElem.onblur = function(e) {
119
- if (pathElem.value === "") selectedSection.innerHTML = "";
135
+ var regexpElems = document.querySelectorAll('#route_table [data-regexp]'),
136
+ searchElem = document.querySelector('#search'),
137
+ exactMatches = document.querySelector('#exact_matches'),
138
+ fuzzyMatches = document.querySelector('#fuzzy_matches');
139
+
140
+ // Remove matches when no search value is present
141
+ searchElem.onblur = function(e) {
142
+ if (searchElem.value === "") {
143
+ setContent(exactMatches, "");
144
+ setContent(fuzzyMatches, "");
145
+ }
120
146
  }
121
147
 
122
148
  // On key press perform a search for matching paths
123
- pathElem.onkeyup = function(e){
124
- var path = sanitizePath(pathElem.value),
125
- defaultText = '<tr><th colspan="4">Paths Matching (' + escape(path) + '):</th></tr>';
149
+ searchElem.onkeyup = function(e){
150
+ var userInput = searchElem.value,
151
+ defaultExactMatch = '<tr><th colspan="4">Paths Matching (' + escape(sanitizePath(userInput)) +'):</th></tr>',
152
+ defaultFuzzyMatch = '<tr><th colspan="4">Paths Containing (' + escape(userInput) +'):</th></tr>',
153
+ noExactMatch = '<tr><th colspan="4">No Exact Matches Found</th></tr>',
154
+ noFuzzyMatch = '<tr><th colspan="4">No Fuzzy Matches Found</th></tr>';
126
155
 
127
156
  // Clear out results section
128
- selectedSection.innerHTML= defaultText;
157
+ setContent(exactMatches, defaultExactMatch);
158
+ setContent(fuzzyMatches, defaultFuzzyMatch);
159
+
160
+ // Display exact matches and fuzzy matches
161
+ each(regexpElems, function(elem) {
162
+ checkExactMatch(exactMatches, elem, userInput);
163
+ checkFuzzyMatch(fuzzyMatches, elem, userInput);
164
+ })
165
+
166
+ // Display 'No Matches' message when no matches are found
167
+ checkNoMatch(exactMatches, defaultExactMatch, noExactMatch);
168
+ checkNoMatch(fuzzyMatches, defaultFuzzyMatch, noFuzzyMatch);
169
+ }
170
+ }
129
171
 
130
- // Display matches if they exist
131
- eachElemsForPath(regexpElems, path, function(e){
132
- selectedSection.appendChild(e);
172
+ // Enables functionality to toggle between `_path` and `_url` helper suffixes
173
+ function setupRouteToggleHelperLinks() {
174
+
175
+ // Sets content for each element
176
+ function setValOn(elems, val) {
177
+ each(elems, function(elem) {
178
+ setContent(elem, val);
133
179
  });
180
+ }
134
181
 
135
- // If no match present, tell the user
136
- if (selectedSection.innerHTML === defaultText) {
137
- selectedSection.innerHTML = selectedSection.innerHTML + noMatchText;
138
- }
182
+ // Sets onClick event for each element
183
+ function onClick(elems, func) {
184
+ each(elems, function(elem) {
185
+ elem.onclick = func;
186
+ });
139
187
  }
188
+
189
+ var toggleLinks = document.querySelectorAll('#route_table [data-route-helper]');
190
+ onClick(toggleLinks, function(){
191
+ var helperTxt = this.getAttribute("data-route-helper"),
192
+ helperElems = document.querySelectorAll('[data-route-name] span.helper');
193
+
194
+ setValOn(helperElems, helperTxt);
195
+ });
140
196
  }
141
197
 
142
198
  setupMatchPaths();
@@ -0,0 +1,10 @@
1
+ module ActionDispatch
2
+ module Routing
3
+ class Endpoint # :nodoc:
4
+ def dispatcher?; false; end
5
+ def redirect?; false; end
6
+ def matches?(req); true; end
7
+ def app; self; end
8
+ end
9
+ end
10
+ end
@@ -5,22 +5,15 @@ module ActionDispatch
5
5
  module Routing
6
6
  class RouteWrapper < SimpleDelegator
7
7
  def endpoint
8
- rack_app ? rack_app.inspect : "#{controller}##{action}"
8
+ app.dispatcher? ? "#{controller}##{action}" : rack_app.inspect
9
9
  end
10
10
 
11
11
  def constraints
12
12
  requirements.except(:controller, :action)
13
13
  end
14
14
 
15
- def rack_app(app = self.app)
16
- @rack_app ||= begin
17
- class_name = app.class.name.to_s
18
- if class_name == "ActionDispatch::Routing::Mapper::Constraints"
19
- rack_app(app.app)
20
- elsif ActionDispatch::Routing::Redirect === app || class_name !~ /^ActionDispatch::Routing/
21
- app
22
- end
23
- end
15
+ def rack_app
16
+ app.app
24
17
  end
25
18
 
26
19
  def verb
@@ -73,7 +66,7 @@ module ActionDispatch
73
66
  end
74
67
 
75
68
  def engine?
76
- rack_app && rack_app.respond_to?(:routes)
69
+ rack_app.respond_to?(:routes)
77
70
  end
78
71
  end
79
72