diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-09 17:28:35 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-09 17:28:35 +0000 |
commit | 2abe3d2cd92e5ee55c39f1b4062ccf60043105f7 (patch) | |
tree | c5ef25295bfef57c54fe5d957428c7422cdda23f /actionpack/lib/action_view/helpers/tag_helper.rb | |
parent | 0fe8e3d6c28f64cf1e35bd129595cd79a7c77091 (diff) | |
download | rails-2abe3d2cd92e5ee55c39f1b4062ccf60043105f7.tar.gz rails-2abe3d2cd92e5ee55c39f1b4062ccf60043105f7.tar.bz2 rails-2abe3d2cd92e5ee55c39f1b4062ccf60043105f7.zip |
Added that nil options are not included in tags, so tag("p", :ignore => nil) now returns <p /> not <p ignore="" /> but that tag("p", :ignore => "") still includes it #1465 [michael@schuerig.de]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1789 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/tag_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/tag_helper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index 1753ef9acf..40fd72d23f 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -24,8 +24,9 @@ module ActionView private def tag_options(options) - unless options.empty? - " " + options.symbolize_keys.map { |key, value| + cleaned_options = options.reject { |key, value| value.nil? } + unless cleaned_options.empty? + " " + cleaned_options.symbolize_keys.map { |key, value| %(#{key}="#{html_escape(value.to_s)}") }.sort.join(" ") end |