From cc6c48f0a8df33d706180bb22e1f39044b1dcbef Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 16 Jun 2005 05:04:17 +0000 Subject: [PATCH] Fixed TagHelper such that :name and 'name' keys in the options doesn't result in two attributes #1455 [take_tk] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1426 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_view/helpers/tag_helper.rb | 3 +-- actionpack/test/template/tag_helper_test.rb | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 75e62096ab..5c61cf49b8 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed TagHelper such that :name and 'name' keys in the options doesn't result in two attributes #1455 [take_tk] + * Ensure that helpers are only available to the controllers where they are defined and their subclasses. #1394 [kdole@tamu.edu] * render("foo/bar") works with a layout again diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index 895a44eab5..1753ef9acf 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -25,8 +25,7 @@ def content_tag(name, content, options = {}) private def tag_options(options) unless options.empty? - options.symbolize_keys - " " + options.map { |key, value| + " " + options.symbolize_keys.map { |key, value| %(#{key}="#{html_escape(value.to_s)}") }.sort.join(" ") end diff --git a/actionpack/test/template/tag_helper_test.rb b/actionpack/test/template/tag_helper_test.rb index f5394bd483..a3acdbcfd3 100644 --- a/actionpack/test/template/tag_helper_test.rb +++ b/actionpack/test/template/tag_helper_test.rb @@ -12,6 +12,10 @@ def test_tag assert_equal tag("p", "class" => "show"), tag("p", :class => "show") end + def test_tag_options + assert_equal "

", tag("p", "class" => "show", :class => "elsewhere") + end + def test_content_tag assert_equal "Create", content_tag("a", "Create", "href" => "create") assert_equal content_tag("a", "Create", "href" => "create"), -- GitLab