diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-10-25 16:10:31 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-10-25 16:10:31 -0700 |
commit | 0afbe74c3b813f998db94adbed2eaa63e3d62ec1 (patch) | |
tree | 48dfb5c2809ec25ea66adb5c27b56a8314dc2911 /actionview/lib/action_view | |
parent | 2982b3018dc23cd211dd6f1f7307e343bc55bd3a (diff) | |
parent | d611036c7709d7c30cbab3110e20e248283af364 (diff) | |
download | rails-0afbe74c3b813f998db94adbed2eaa63e3d62ec1.tar.gz rails-0afbe74c3b813f998db94adbed2eaa63e3d62ec1.tar.bz2 rails-0afbe74c3b813f998db94adbed2eaa63e3d62ec1.zip |
Merge pull request #17064 from frenkel/fix_select_tag_include_blank
Use include_blank value as option label
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/helpers/form_tag_helper.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 69893b8abd..74cfec962e 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -133,8 +133,14 @@ module ActionView option_tags ||= "" html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name - if options.delete(:include_blank) - option_tags = content_tag(:option, '', :value => '').safe_concat(option_tags) + + if options.include?(:include_blank) + include_blank = options.delete(:include_blank) + if include_blank == true + include_blank = '' + end + + option_tags = content_tag(:option, include_blank, :value => '').safe_concat(option_tags) end if prompt = options.delete(:prompt) |