This project is archived and is in readonly mode.

#5099 ✓resolved
John Firebaugh

:include_blank and :prompt options for #select not HTML safe

Reported by John Firebaugh | July 12th, 2010 @ 08:36 PM | in 3.x

String options :include_blank and :prompt options are not HTML-escaped or checked for safety before being concatenated with markup.

select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {:include_blank => '<None>'})

produces:

<select name="post[person_id]">
     <option value=""><None></option>
     <option value="1">David</option>
     <option value="2" selected="selected">Sam</option>
     <option value="3">Tobias</option>
</select>

It should produce:

<select name="post[person_id]">
     <option value="">&lt;None&gt;</option>
     <option value="1">David</option>
     <option value="2" selected="selected">Sam</option>
     <option value="3">Tobias</option>
</select>

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages