This project is archived and is in readonly mode.

[patch] DateHelpers ignore html_options
Reported by Marc Schütz | January 28th, 2010 @ 07:27 PM | in 2.3.6
select_time/select_date and friends don't add the html_options to the hidden fields they create (i.e. hour&minute for select_date, year,month&day for select_time), because they are not used by build_hidden().
Consider the case where you want to build a disabled time selector. Because the hidden fields are not disabled, they are submitted by the browser and end up in the controller's params. If you call update_attributes, it will assign the corresponding field a value.
Patch attached.
Comments and changes to this ticket
- 
            
         Marc Schütz February 18th, 2010 @ 02:39 PM- Tag set to patch, rails3
 
- 
         Santiago Pastorino March 4th, 2010 @ 09:22 PMCan you provide a failing test and a patch that applies cleanly on master? please. 
- 
            
         Marc Schütz March 5th, 2010 @ 10:44 AMHere is an up-to-date patch. I don't know how to build a test case though. Basically it will have to check whether the output of 
 containsf.time_select :start_time, {}, {:disabled => true}disabled="disabled"in the fields for year, month and date:
 <input disabled="disabled" id="play_start_time_1i" name="play[start_time(1i)]" type="hidden" value="2010" /> <input disabled="disabled" id="play_start_time_2i" name="play[start_time(2i)]" type="hidden" value="3" /> <input disabled="disabled" id="play_start_time_3i" name="play[start_time(3i)]" type="hidden" value="5" />
- 
         Jeremy Kemper March 5th, 2010 @ 03:53 PM- Milestone set to 2.3.6
- State changed from new to open
- Assigned user set to Santiago Pastorino
 
- 
         Santiago Pastorino March 5th, 2010 @ 09:43 PMHere is the patch that applies cleanly on both master and 2-3-stable 
- 
         Santiago Pastorino March 5th, 2010 @ 09:51 PM- Tag changed from patch, rails3 to 2.3.x, patch, rails3
 
- 
         Repository March 5th, 2010 @ 10:02 PM- State changed from open to committed
 (from [d3a815220345e9e0d7081c6d05bef55560466d41]) Adds disable option to date_helpers generated hidden fields when html_options specifies it. ht by Marc Schütz [#3807 state:committed] Signed-off-by: Jeremy Kemper jeremy@bitsweat.net 
 http://github.com/rails/rails/commit/d3a815220345e9e0d7081c6d05bef5...
- 
         Repository March 5th, 2010 @ 10:02 PM(from [e472f76e4c86cfc1350f3b769d9ac3d96f062e3f]) Adds disable option to date_helpers generated hidden fields when html_options specifies it. ht by Marc Schütz [#3807 state:committed] Signed-off-by: Jeremy Kemper jeremy@bitsweat.net 
 http://github.com/rails/rails/commit/e472f76e4c86cfc1350f3b769d9ac3...
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>
People watching this ticket
Attachments
Referenced by
- 
         3807 
          [patch] DateHelpers ignore html_options
        [#3807 state:committed] 3807 
          [patch] DateHelpers ignore html_options
        [#3807 state:committed]
- 
         3807 
          [patch] DateHelpers ignore html_options
        [#3807 state:committed] 3807 
          [patch] DateHelpers ignore html_options
        [#3807 state:committed]
 Jeremy Kemper
      Jeremy Kemper
 Marc Schütz
      Marc Schütz