Skip to content

Commit

Permalink
Show routes defined under assets prefix
Browse files Browse the repository at this point in the history
Closes #9625
  • Loading branch information
tricknotes authored and carlosantoniodasilva committed Dec 19, 2013
1 parent c5b76b5 commit d54bc03
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions actionpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* `rake routes` shows routes defined under assets prefix.

*Ryunosuke SATO*

* Extend cross-site request forgery (CSRF) protection to GET requests with
JavaScript responses, protecting apps from cross-origin `<script>` tags.

Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def action
end

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

def engine?
Expand Down
12 changes: 12 additions & 0 deletions actionpack/test/dispatch/routing/inspector_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ def test_rake_routes_dont_show_app_mounted_in_assets_prefix
assert_no_match(/\/sprockets/, output.first)
end

def test_rake_routes_shows_route_defined_in_under_assets_prefix
output = draw do
scope '/sprockets' do
get '/foo' => 'foo#bar'
end
end
assert_equal [
"Prefix Verb URI Pattern Controller#Action",
" foo GET /sprockets/foo(.:format) foo#bar"
], output
end

def test_redirect
output = draw do
get "/foo" => redirect("/foo/bar"), :constraints => { :subdomain => "admin" }
Expand Down

0 comments on commit d54bc03

Please sign in to comment.