Skip to content

Commit

Permalink
Merge pull request #5174 from nashby/safe-concat
Browse files Browse the repository at this point in the history
use content_tag instead of strings
  • Loading branch information
josevalim committed Feb 25, 2012
2 parents eecb086 + 2bc879a commit cbe74cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions actionpack/lib/action_view/helpers/tags/base.rb
Expand Up @@ -133,13 +133,14 @@ def select_content_tag(option_tags, options, html_options)


def add_options(option_tags, options, value = nil) def add_options(option_tags, options, value = nil)
if options[:include_blank] 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 end
if value.blank? && options[:prompt] if value.blank? && options[:prompt]
prompt = options[:prompt].kind_of?(String) ? options[:prompt] : I18n.translate('helpers.select.prompt', :default => 'Please select') 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 end
option_tags.html_safe option_tags
end end
end end
end end
Expand Down

0 comments on commit cbe74cf

Please sign in to comment.