diff options
author | Hongli Lai (Phusion) <hongli@phusion.nl> | 2008-11-13 21:49:23 +0100 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-11-13 21:55:58 +0100 |
commit | 4e9abdd7f1b4e05f8d1b50ddaa080b3ff63b92d9 (patch) | |
tree | da8f41b6b511a4fdf04d1d25ee0e94ec7cd19475 /actionpack/lib/action_view | |
parent | 4c0921024471c0463d67f8b8fb6a115a94d343aa (diff) | |
download | rails-4e9abdd7f1b4e05f8d1b50ddaa080b3ff63b92d9.tar.gz rails-4e9abdd7f1b4e05f8d1b50ddaa080b3ff63b92d9.tar.bz2 rails-4e9abdd7f1b4e05f8d1b50ddaa080b3ff63b92d9.zip |
Tag helper should output an attribute with the value 'false' instead of omitting the attribute, if the associated option is false but not nil.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/tag_helper.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index de08672d2d..d37ca766af 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -133,10 +133,12 @@ module ActionView unless options.blank? attrs = [] if escape - options.each do |key, value| - next unless value - value = BOOLEAN_ATTRIBUTES.include?(key) ? key : escape_once(value) - attrs << %(#{key}="#{value}") + options.each_pair do |key, value| + if BOOLEAN_ATTRIBUTES.include?(key) + attrs << %(#{key}="#{key}") if value + else + attrs << %(#{key}="#{escape_once(value)}") if !value.nil? + end end else attrs = options.map { |key, value| %(#{key}="#{value}") } |