Permalink
Browse files

Dynamically generaeted helpers on collection should not clobber resou…

…rces url helper [#6028 state:resolved]
  • Loading branch information...
1 parent 08e9d0d commit 7e903a3d3a661c6ed4164d6a563bcf54e4497db3 @josevalim josevalim committed Nov 25, 2010
Showing with 13 additions and 0 deletions.
  1. +2 −0 actionpack/lib/action_dispatch/routing/mapper.rb
  2. +11 −0 actionpack/test/dispatch/routing_test.rb
@@ -1265,6 +1265,8 @@ def name_for_action(as, action)
name_prefix = @scope[:as]
if parent_resource
+ return nil if as.nil? && action.nil?
+
collection_name = parent_resource.collection_name
member_name = parent_resource.member_name
end
@@ -155,6 +155,11 @@ def self.matches?(request)
end
resources :replies do
+ collection do
+ get 'page/:page' => 'replies#index', :page => %r{\d+}
+ get ':page' => 'replies#index', :page => %r{\d+}
+ end
+
new do
post :preview
end
@@ -1249,6 +1254,12 @@ def test_match_shorthand_inside_namespace
end
end
+ def test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper
+ with_test_routes do
+ assert_equal '/replies', replies_path
+ end
+ end
+
def test_scoped_controller_with_namespace_and_action
with_test_routes do
assert_equal '/account/twitter/callback', account_callback_path("twitter")

0 comments on commit 7e903a3

Please sign in to comment.