diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-06 14:16:25 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-06 14:16:25 +0000 |
commit | 688f0f6712a37474e92f86de1046f5aa0e11030e (patch) | |
tree | e6d4d123281cd577600d80bff9ea776ef6ce3ceb /actionpack | |
parent | 6e5a7340e697e89ecab98b4c60ee346b8ed9a741 (diff) | |
download | rails-688f0f6712a37474e92f86de1046f5aa0e11030e.tar.gz rails-688f0f6712a37474e92f86de1046f5aa0e11030e.tar.bz2 rails-688f0f6712a37474e92f86de1046f5aa0e11030e.zip |
Fixed that map.connect should convert arguments to strings #780 [Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@855 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/routing_tests.rb | 13 |
3 files changed, 16 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 4f36209cca..6f1bd4d3d7 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed that map.connect should convert arguments to strings #780 [Nicholas Seckar] + * Added UrlHelper#link_to_if/link_to_unless to enable other conditions that just link_to_unless_current #757 [mindel] * Fixed that single quote was not escaped in a UrlHelper#link_to javascript confirm #549 [Scott Barron] diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index 894b3476e1..218697aca8 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -15,7 +15,7 @@ module ActionController raise ArgumentError, "Regexp requirement on #{k}, but #{k} is not in this route's path!" unless @items.include? k @requirements[k] = v else - (@items.include?(k) ? @defaults : @requirements)[k] = v + (@items.include?(k) ? @defaults : @requirements)[k] = (v.nil? ? nil : v.to_s) end end diff --git a/actionpack/test/controller/routing_tests.rb b/actionpack/test/controller/routing_tests.rb index 360ca06cf8..d4f954e590 100644 --- a/actionpack/test/controller/routing_tests.rb +++ b/actionpack/test/controller/routing_tests.rb @@ -490,6 +490,19 @@ class RouteSetTests < Test::Unit::TestCase @set.add_route(@rails_route) if @set.empty? assert_raises(ActionController::RoutingError) {@set.recognize!(@request)} end + + def test_generate_of_empty_url + @set.connect '', :controller => 'content', :action => 'view', :id => "1" + @set.add_route(@rails_route) + verify_generate('content/view/2', {:controller => 'content', :action => 'view', :id => 2}) + verify_generate('', {:controller => 'content', :action => 'view', :id => 1}) + end + def test_generate_of_empty_url_with_numeric_requirement + @set.connect '', :controller => 'content', :action => 'view', :id => 1 + @set.add_route(@rails_route) + verify_generate('content/view/2', {:controller => 'content', :action => 'view', :id => 2}) + verify_generate('', {:controller => 'content', :action => 'view', :id => 1}) + end end #require '../assertions/action_pack_assertions.rb' |