Skip to content

Commit d54bc03

Browse files
tricknotescarlosantoniodasilva
authored andcommitted
Show routes defined under assets prefix
Closes rails#9625
1 parent c5b76b5 commit d54bc03

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

actionpack/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* `rake routes` shows routes defined under assets prefix.
2+
3+
*Ryunosuke SATO*
4+
15
* Extend cross-site request forgery (CSRF) protection to GET requests with
26
JavaScript responses, protecting apps from cross-origin `<script>` tags.
37

actionpack/lib/action_dispatch/routing/inspector.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def action
6969
end
7070

7171
def internal?
72-
controller.to_s =~ %r{\Arails/(info|mailers|welcome)} || path =~ %r{\A#{Rails.application.config.assets.prefix}}
72+
controller.to_s =~ %r{\Arails/(info|mailers|welcome)} || path =~ %r{\A#{Rails.application.config.assets.prefix}\z}
7373
end
7474

7575
def engine?

actionpack/test/dispatch/routing/inspector_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,18 @@ def test_rake_routes_dont_show_app_mounted_in_assets_prefix
203203
assert_no_match(/\/sprockets/, output.first)
204204
end
205205

206+
def test_rake_routes_shows_route_defined_in_under_assets_prefix
207+
output = draw do
208+
scope '/sprockets' do
209+
get '/foo' => 'foo#bar'
210+
end
211+
end
212+
assert_equal [
213+
"Prefix Verb URI Pattern Controller#Action",
214+
" foo GET /sprockets/foo(.:format) foo#bar"
215+
], output
216+
end
217+
206218
def test_redirect
207219
output = draw do
208220
get "/foo" => redirect("/foo/bar"), :constraints => { :subdomain => "admin" }

0 commit comments

Comments
 (0)