aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-19 06:07:48 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-19 06:07:48 -0700
commitf4ad0ebe7a6b17658bddfeb996e3c34835b75623 (patch)
tree0f78d104ab983fd05f9f1ae5dc240237b719a0b6
parent8b2cbb3a832101f0e672ee309beca0f8c555b292 (diff)
parent641ea6925790771acb6e91b73f9efa6ded834761 (diff)
downloadrails-f4ad0ebe7a6b17658bddfeb996e3c34835b75623.tar.gz
rails-f4ad0ebe7a6b17658bddfeb996e3c34835b75623.tar.bz2
rails-f4ad0ebe7a6b17658bddfeb996e3c34835b75623.zip
Merge pull request #7668 from Draiken/fix_issue_6497
Removing to_shorthand to fix #6497
-rw-r--r--actionpack/CHANGELOG.md14
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/test/dispatch/routing_test.rb7
3 files changed, 20 insertions, 3 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 39105c5ca3..7212e3a289 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -4,9 +4,19 @@
*Yves Senn*
-* Allow pass couple extensions to ActionView::Template.register_template_handler call. *Tima Maslyuchenko*
+* Allow pass couple extensions to `ActionView::Template.register_template_handler` call. *Tima Maslyuchenko*
-* Sprockets integration has been extracted from Action Pack and the `sprockets-rails`
+* 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*
+
+* Sprockets integration has been extracted from Action Pack and the `sprockets-rails`
gem should be added to Gemfile (under the assets group) in order to use Rails asset
pipeline in future versions of Rails.
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index ddb34a2394..49afa01d25 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -182,7 +182,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 856248e2ac..4e83ad16d7 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -363,6 +363,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
resources :errors, :shallow => true do
resources :notices
end
+ get 'api/version'
end
scope :path => 'api' do
@@ -1280,6 +1281,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'account#shorthand', @response.body
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
assert_equal '/replies', replies_path
end