Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Named Routes shouldn't override existing ones (currently rout…

…e recognition goes with the earliest match, named routes use the latest match)"

This reverts commit 71d769e.
  • Loading branch information...
commit e9122112facf56131d4bf0739382d9235582f8c0 1 parent c4a29de
@tenderlove tenderlove authored
View
2  actionpack/lib/action_dispatch/routing/route_set.rb
@@ -356,7 +356,7 @@ def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil
conditions = build_conditions(conditions, valid_conditions, path.names.map { |x| x.to_sym })
route = @set.add_route(app, path, conditions, defaults, name)
- named_routes[name] = route if name && !named_routes[name]
+ named_routes[name] = route if name
route
end
View
4 actionpack/test/controller/routing_test.rb
@@ -789,12 +789,12 @@ def test_named_draw
assert_equal set.routes.first, set.named_routes[:hello]
end
- def test_earlier_named_routes_take_precedence
+ def test_later_named_routes_take_precedence
set.draw do
match '/hello/world' => 'a#b', :as => 'hello'
match '/hello' => 'a#b', :as => 'hello'
end
- assert_equal set.routes.first, set.named_routes[:hello]
+ assert_equal set.routes.last, set.named_routes[:hello]
end
def setup_named_route_test
Please sign in to comment.
Something went wrong with that request. Please try again.