diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-19 06:07:48 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-19 10:10:00 -0300 |
commit | 61d5d2d8a97fd289b81991cd79dca3112e7ca135 (patch) | |
tree | d8f236d7ed6e7fd26829e0558ee5ddc242d49fee /actionpack | |
parent | a82f1e3f5d11c8dfba9f4c911745ec40a7965216 (diff) | |
download | rails-61d5d2d8a97fd289b81991cd79dca3112e7ca135.tar.gz rails-61d5d2d8a97fd289b81991cd79dca3112e7ca135.tar.bz2 rails-61d5d2d8a97fd289b81991cd79dca3112e7ca135.zip |
Merge pull request #7668 from Draiken/fix_issue_6497
Removing to_shorthand to fix #6497
Conflicts:
actionpack/CHANGELOG.md
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG.md | 10 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 7 |
3 files changed, 18 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index c52241a9c0..e86008d26c 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,5 +1,15 @@ ## Rails 3.2.9 (unreleased) ## +* Fixed a bug with shorthand routes scoped with the `:module` option not + adding the module to the controller as described in issue #6497. + This should now work properly: + + scope :module => "engine" do + get "api/version" # routes to engine/api#version + end + + *Luiz Felipe Garcia Pereira* + * Respect `config.digest = false` for `asset_path` Previously, the `asset_path` internals only respected the `:digest` diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 40ff69693b..266d2d5fd1 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -166,7 +166,7 @@ module ActionDispatch controller ||= default_controller action ||= default_action - unless controller.is_a?(Regexp) || to_shorthand + unless controller.is_a?(Regexp) controller = [@scope[:module], controller].compact.join("/").presence end diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 00c71dc8be..dc1f524d3b 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -362,6 +362,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resources :errors, :shallow => true do resources :notices end + get 'api/version' end scope :path => 'api' do @@ -1376,6 +1377,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_match_shorthand_with_module + assert_equal '/api/version', api_version_path + get '/api/version' + assert_equal 'api/api#version', @response.body + end + def test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper with_test_routes do assert_equal '/replies', replies_path |