aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2016-05-09 02:36:58 +0530
committerVipul A M <vipulnsward@gmail.com>2016-05-21 15:43:35 +0800
commit9bfd968bed1a76888ec82e0f7b524a989d0e1108 (patch)
tree67b396ef0b92385bd5996fb0617abab989f166e9 /actionview/lib
parent694cbbf801e46d7ec533ece4637412838f02723e (diff)
downloadrails-9bfd968bed1a76888ec82e0f7b524a989d0e1108.tar.gz
rails-9bfd968bed1a76888ec82e0f7b524a989d0e1108.tar.bz2
rails-9bfd968bed1a76888ec82e0f7b524a989d0e1108.zip
Confirm with the specification when generating emtpy option for select with `include_blank: true` option.
We now generate option with empty label, example: `<select id="places" name="places"><option value="" label=" "></option></select>` for include_blank: true. This is only done, if content is missing on the option, and we providing the value from this option. Fixes #24816
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/form_tag_helper.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb
index cfff0bef5d..82f2fd30c7 100644
--- a/actionview/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionview/lib/action_view/helpers/form_tag_helper.rb
@@ -134,13 +134,15 @@ module ActionView
if options.include?(:include_blank)
include_blank = options.delete(:include_blank)
+ options_for_blank_options_tag = { value: '' }
if include_blank == true
include_blank = ''
+ options_for_blank_options_tag[:label] = ' '
end
if include_blank
- option_tags = content_tag("option".freeze, include_blank, value: '').safe_concat(option_tags)
+ option_tags = content_tag("option".freeze, include_blank, options_for_blank_options_tag).safe_concat(option_tags)
end
end