aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/tag_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/tag_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/tag_helper.rb5
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