This project is archived and is in readonly mode.

#1987 ✓resolved
Clemens Kofler

select_tag should allow :include_blank option

Reported by Clemens Kofler | February 16th, 2009 @ 12:22 PM | in 3.x

I think that "select_tag" should allow the :include_blank just like its object-related sibling "select" does. This makes it much easier to construct forms in a not strictly object-related context.

Examples:

<%= select_tag "country", %(<option value=""></option>) + options_for_select(Country.all) %>

would become

<%= select_tag "country", options_for_select(Country.all), :include_blank => true %>

<%= select_tag "country", %(<option value="">any</option>) + options_for_select(Country.all) %>

would become

<%= select_tag "country", options_for_select(Country.all), :include_blank => "any" %>

A patch including tests is attached.

Comments and changes to this ticket

<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>

Referenced by

Pages