aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorFrank Groeneveld <frank@ivaldi.nl>2014-10-17 08:21:56 +0200
committerFrank Groeneveld <frank@ivaldi.nl>2014-10-17 08:21:56 +0200
commitd611036c7709d7c30cbab3110e20e248283af364 (patch)
tree0eaa7e790f03f47d6d492f261b10126b38e93117 /actionview/lib
parent4af5899e25229961cbd3df9dfe80c2f46fa04f6c (diff)
downloadrails-d611036c7709d7c30cbab3110e20e248283af364.tar.gz
rails-d611036c7709d7c30cbab3110e20e248283af364.tar.bz2
rails-d611036c7709d7c30cbab3110e20e248283af364.zip
Use include_blank value as option label
Update select_tag to reflect documentation and behave the same as form builder select. If the value of include_blank is not boolean true, use that value as the option label.
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/form_tag_helper.rb10
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 7d1cdc5a68..cf1e20cf55 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)