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.

Regression in date_select between 2.1.1 and 2.2 RC1

#1289

Date_select blows up when given certain options on Rails 2.2 RC1. Attaching test which passes on 2.1.1 and fails on edge/2.2 RC1.

Tor Erik

Reported by Tor Erik · October 29th, 2008 @ 02:54 PM

State: committed
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. DHH
    DHH
    • Milestone cleared.

    October 30th, 2008 @ 10:39 AM

  2. Bernardo Padua
    Bernardo Padua
    • Tag changed from 2.2.rc1, actionview, date_helper to 2.2.rc1, actionview, date_helper, patch

    This bug occurs whenever trying to use the +date_select+ and +datetime_select+ helpers with a date / datetime attribute that has a nil value (eg.: it wasn't set yet), and you configure the helper to discard the day.

    @@@ Ruby <%= form.date_select 'end_date',

    :discard_day => true,
    :include_blank => true %>
    
    
    
    
    This simple patch fixes it. It includes the tests written by Tor Erik, with a minor modification to make they pass as expected.
    
    It breaks current apps and is hard to debug so I think it should be applied ASAP, before the rails 2.2 release.
    

    November 4th, 2008 @ 02:44 AM

  3. Bernardo Padua
    Bernardo Padua

    Sorry for the ugly formatting, I don't think code highlighting worked very well.

    November 4th, 2008 @ 02:46 AM

  4. Repository
    Repository
    • State changed from new to committed

    (from [b2cd318c2e3f4d19813a5c62903319a6683aa561]) Fix regression bug that made date_select and datetime_select raise a Null Pointer Exception when a nil date/datetime was passed and only month and year were displayed [#1289 state:committed]

    Signed-off-by: David Heinemeier Hansson david@loudthinking.com http://github.com/rails/rails/co...

    November 4th, 2008 @ 05:21 PM