Skip to content
Browse files

Fixed UrlHelper#link_to_unless so it doesn't care if the id is a stri…

…ng or fixnum [zenspider]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@256 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent a89e36a commit d91405a415819a626427373437e0929b19914cf4 @dhh dhh committed Dec 22, 2004
View
2 actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed UrlHelper#link_to_unless so it doesn't care if the id is a string or fixnum [zenspider]
+
* Added search through session to clear out association caches at the end of each request. This makes it possible to place Active Record objects
in the session without worrying about stale data in the associations (the main object is still subject to caching, naturally) #347 [Tobias Luetke]
View
1 actionpack/lib/action_view/helpers/tag_helper.rb
@@ -1,4 +1,5 @@
require 'cgi'
+require 'erb'
module ActionView
module Helpers
View
8 actionpack/lib/action_view/helpers/url_helper.rb
@@ -96,9 +96,9 @@ def mail_to(email_address, name = nil, html_options = {})
def destination_equal_to_current(options)
params_without_location = @params.reject { |key, value| %w( controller action id ).include?(key) }
- options[:action] == @params['action'] &&
- options[:id] == @params['id'] &&
- options[:controller] == @params['controller'] &&
+ options[:action].to_s == @params['action'].to_s &&
+ options[:id].to_s == @params['id'].to_s &&
+ options[:controller].to_s == @params['controller'].to_s &&
(options.has_key?(:params) ? params_without_location == options[:params] : true)
end
@@ -120,4 +120,4 @@ def convert_confirm_option_to_javascript!(html_options)
end
end
end
-end
+end
View
5 actionpack/test/template/url_helper_test.rb
@@ -43,6 +43,9 @@ def test_link_unless_current
@params = { "controller" => "weblog", "action" => "show"}
assert_equal "Showing", link_to_unless_current("Showing", :action => "show", :controller => "weblog")
assert "<a href=\"http://www.world.com\">Listing</a>", link_to_unless_current("Listing", :action => "list", :controller => "weblog")
+
+ @params = { "controller" => "weblog", "action" => "show", "id" => "1"}
+ assert_equal "Showing", link_to_unless_current("Showing", :action => "show", :controller => "weblog", :id => 1)
end
def test_mail_to
@@ -58,4 +61,4 @@ def test_link_with_nil_html_options
assert "<a href=\"http://www.world.com\">Hello</a>",
link_to("Hello", {:action => 'myaction'}, nil)
end
-end
+end

0 comments on commit d91405a

Please sign in to comment.
Something went wrong with that request. Please try again.