Permalink
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...
1 parent c4a29de commit e9122112facf56131d4bf0739382d9235582f8c0 @tenderlove tenderlove committed Jan 3, 2012
@@ -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
@@ -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

0 comments on commit e912211

Please sign in to comment.