diff options
author | Ivan Torres <mexpolk@gmail.com> | 2010-07-14 01:23:41 -0500 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-18 11:32:00 +0200 |
commit | cdfa11409c6196d35e890cf1766e1e2cc6f3d7d7 (patch) | |
tree | 0db626c8054907007fea7e811c0294ea7b43292a /actionpack/lib | |
parent | 1f499e6d4cb1055de952957e3c9bd770e0219cc1 (diff) | |
download | rails-cdfa11409c6196d35e890cf1766e1e2cc6f3d7d7.tar.gz rails-cdfa11409c6196d35e890cf1766e1e2cc6f3d7d7.tar.bz2 rails-cdfa11409c6196d35e890cf1766e1e2cc6f3d7d7.zip |
select :include_blank or :prompt should return escaped string [#5099 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 6f9d14de8b..ee34452769 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -447,7 +447,7 @@ module ActionView # wrap the output in an appropriate <tt><select></tt> tag. def grouped_options_for_select(grouped_options, selected_key = nil, prompt = nil) body = '' - body << content_tag(:option, prompt, :value => "") if prompt + body << content_tag(:option, prompt, { :value => "" }, true) if prompt grouped_options = grouped_options.sort if grouped_options.is_a?(Hash) @@ -593,11 +593,11 @@ module ActionView private def add_options(option_tags, options, value = nil) if options[:include_blank] - option_tags = "<option value=\"\">#{options[:include_blank] if options[:include_blank].kind_of?(String)}</option>\n" + option_tags + option_tags = "<option value=\"\">#{html_escape(options[:include_blank]) if options[:include_blank].kind_of?(String)}</option>\n" + option_tags end if value.blank? && options[:prompt] prompt = options[:prompt].kind_of?(String) ? options[:prompt] : I18n.translate('helpers.select.prompt', :default => 'Please select') - option_tags = "<option value=\"\">#{prompt}</option>\n" + option_tags + option_tags = "<option value=\"\">#{html_escape(prompt)}</option>\n" + option_tags end option_tags.html_safe end |