From 64e1d55375eca364bbd00068f7fb26d6bdcc855d Mon Sep 17 00:00:00 2001 From: Diego Carrion Date: Sun, 6 Mar 2011 02:06:04 -0300 Subject: [PATCH] named routes with spaces are striped --- .../lib/action_dispatch/routing/route_set.rb | 1 + actionpack/test/controller/routing_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index fc86d52..c079478 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -330,6 +330,7 @@ module ActionDispatch end def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil, anchor = true) + name.try :strip! route = Route.new(self, app, conditions, requirements, defaults, name, anchor) @set.add_route(*route) named_routes[name] = route if name diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 18cf944..8e4497e 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -206,6 +206,13 @@ class LegacyRouteSetTests < Test::Unit::TestCase assert_equal("http://test.host/", setup_for_named_route.send(:home_url)) end + def test_basic_named_route_with_space + rs.draw do + root :to => 'content#list', :as => 'home ' + end + assert_equal("http://test.host/", setup_for_named_route.send(:home_url)) + end + def test_named_route_with_option rs.draw do match 'page/:title' => 'content#show_page', :as => 'page' -- 1.6.5.2