Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[patch] DateHelpers ignore html_options

#3807

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.

Reported by Marc Schütz · January 28th, 2010 @ 07:27 PM

State: committed
Milestone: 2.3.6
Assigned to: Santiago Pastorino Santiago Pastorino
Importance: Low

Activity

  1. Marc Schütz
    Marc Schütz
    • Tag set to patch, rails3

    February 18th, 2010 @ 02:39 PM

  2. Santiago Pastorino
    Santiago Pastorino

    Can you provide a failing test and a patch that applies cleanly on master? please.

    March 4th, 2010 @ 09:22 PM

  3. Marc Schütz
    Marc Schütz

    Here 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

    f.time_select :start_time, {}, {:disabled => true}
    
    contains 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" />
    

    March 5th, 2010 @ 10:44 AM

  4. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 2.3.6
    • State changed from new to open
    • Assigned user set to Santiago Pastorino

    March 5th, 2010 @ 03:53 PM

  5. Santiago Pastorino
    Santiago Pastorino

    Here is the patch that applies cleanly on both master and 2-3-stable

    March 5th, 2010 @ 09:43 PM

  6. Santiago Pastorino
    Santiago Pastorino
    • Tag changed from patch, rails3 to 2.3.x, patch, rails3

    March 5th, 2010 @ 09:51 PM

  7. Repository
    Repository
    • 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 [patch] DateHelpers ignore html_options state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/d3a815220345e9e0d7081c6d05bef5...

    March 5th, 2010 @ 10:02 PM

  8. Repository
    Repository

    (from [e472f76e4c86cfc1350f3b769d9ac3d96f062e3f]) Adds disable option to date_helpers generated hidden fields when html_options specifies it. ht by Marc Schütz

    [#3807 [patch] DateHelpers ignore html_options state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/e472f76e4c86cfc1350f3b769d9ac3...

    March 5th, 2010 @ 10:02 PM