From 622e4ab424ea260cd3ebe3768b1a2a4e5ae1384e Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 25 Jun 2013 11:00:19 +0100 Subject: Fix shorthand routes where controller and action are in the scope Merge `:action` from routing scope and assign endpoint if both `:controller` and `:action` are present. The endpoint assignment only occurs if there is no `:to` present in the options hash so should only affect routes using the shorthand syntax (i.e. endpoint is inferred from the the path). Fixes #9856 Backport of 37b4276 --- actionpack/test/dispatch/routing_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 88a5c37c43..c5a5c07b80 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -529,6 +529,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end end + + scope '/job', controller: 'job' do + scope ':id', action: 'manage_applicant' do + get "/active" + end + end end end @@ -1444,6 +1450,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_controller_option_with_nesting_and_leading_slash + with_test_routes do + get '/job/5/active' + assert_equal 'job#manage_applicant', @response.body + end + end + def test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper with_test_routes do assert_equal '/replies', replies_path -- cgit v1.2.3