Forum: Ruby on Rails date_select bug in Rails 1.2.2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
203d54ac4265400c0bbad7a68015d34d?d=identicon&s=25 Yue Teng (Guest)
on 2007-02-25 08:54
I have just upgraded to Rails 1.2.2 and date_select seems to be having a
problem. In Rails 1.2.2,

<%= date_select 'so_header', 'date'  %>

expands to:


<p><label for="so_header_date">Date</label><br/>
<select name="so_header[date(1i)]">
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007" selected="selected">2007</option>

<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
</select>
<select name="so_header[date(2i)]">
<option value="1">January</option>
<option value="2" selected="selected">February</option>
<option value="3">March</option>

<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>

</select>
<select
name="use_hiddendiscard_hourtruediscard_typetrueorderyearmonthdayhourminutesecondprefixso_header[date(3i)][day]">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>

<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>

<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>

<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>

Notice that the name of the day field is corrupted as:

name="use_hiddendiscard_hourtruediscard_typetrueorderyearmonthdayhourminutesecondprefixso_header[date(3i)][day]">

and therefore the date when selected cannot be parsed by ROR properly.

I have confirmed that Rails 1.1.6 works OK and the bug occurs only in
1.2.1 and 1.2.2.

Has anyone else encountered this?
This topic is locked and can not be replied to.