Skip to content

Commit

Permalink
Merge pull request #7668 from Draiken/fix_issue_6497
Browse files Browse the repository at this point in the history
Removing to_shorthand to fix #6497
  • Loading branch information
rafaelfranca committed Sep 19, 2012
2 parents 8b2cbb3 + 641ea69 commit f4ad0eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
14 changes: 12 additions & 2 deletions actionpack/CHANGELOG.md
Expand Up @@ -4,9 +4,19 @@


*Yves Senn* *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 gem should be added to Gemfile (under the assets group) in order to use Rails asset
pipeline in future versions of Rails. pipeline in future versions of Rails.


Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/mapper.rb
Expand Up @@ -182,7 +182,7 @@ def default_controller_and_action(to_shorthand=nil)
controller ||= default_controller controller ||= default_controller
action ||= default_action action ||= default_action


unless controller.is_a?(Regexp) || to_shorthand unless controller.is_a?(Regexp)
controller = [@scope[:module], controller].compact.join("/").presence controller = [@scope[:module], controller].compact.join("/").presence
end end


Expand Down
7 changes: 7 additions & 0 deletions actionpack/test/dispatch/routing_test.rb
Expand Up @@ -363,6 +363,7 @@ def self.call(params, request)
resources :errors, :shallow => true do resources :errors, :shallow => true do
resources :notices resources :notices
end end
get 'api/version'
end end


scope :path => 'api' do scope :path => 'api' do
Expand Down Expand Up @@ -1280,6 +1281,12 @@ def test_match_shorthand_inside_namespace
assert_equal 'account#shorthand', @response.body assert_equal 'account#shorthand', @response.body
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 def test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper
assert_equal '/replies', replies_path assert_equal '/replies', replies_path
end end
Expand Down

0 comments on commit f4ad0eb

Please sign in to comment.