Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use content_tag instead strings

  • Loading branch information...
commit 2bc879a43d1b7b97de871d993d1bd63414e83677 1 parent eecb086
@nashby nashby authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 actionpack/lib/action_view/helpers/tags/base.rb
View
7 actionpack/lib/action_view/helpers/tags/base.rb
@@ -133,13 +133,14 @@ def select_content_tag(option_tags, options, html_options)
def add_options(option_tags, options, value = nil)
if options[:include_blank]
- option_tags = "<option value=\"\">#{ERB::Util.html_escape(options[:include_blank]) if options[:include_blank].kind_of?(String)}</option>\n" + option_tags
+ include_blank = options[:include_blank] if options[:include_blank].kind_of?(String)
+ option_tags = content_tag(:option, include_blank, :value => '').safe_concat("\n").safe_concat(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=\"\">#{ERB::Util.html_escape(prompt)}</option>\n" + option_tags
+ option_tags = content_tag(:option, prompt, :value => '').safe_concat("\n").safe_concat(option_tags)
end
- option_tags.html_safe
+ option_tags
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.