Skip to content

Commit

Permalink
Fixed that map.connect should convert arguments to strings #780 [Nich…
Browse files Browse the repository at this point in the history
…olas Seckar]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@855 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Mar 6, 2005
1 parent 6e5a734 commit 688f0f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions 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]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/routing.rb
Expand Up @@ -15,7 +15,7 @@ def initialize(path, hash={})
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

Expand Down
13 changes: 13 additions & 0 deletions actionpack/test/controller/routing_tests.rb
Expand Up @@ -490,6 +490,19 @@ def test_url_with_dots_in_controller
@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'
Expand Down

0 comments on commit 688f0f6

Please sign in to comment.