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.

Fix before_type_cast for timezone aware datetime attributes

#6489

The change made to allow timezone aware datetime attributes support before_type_cast function does not work correctly. The test for the change does not exercise the code because before the timezone_aware_attributes flag is not set to true for the model used in the test. This means the timezone aware write accessor is not created for the attribute used in the test. Instead, the default write accessor is created for this attribute which does not correctly handle the timezones.

This patch fixes the test and the code

See this ticket for more context.

https://rails.lighthouseapp.com/projects/8994/tickets/3973-before_t...

Reported by Adam Meehan · February 28th, 2011 @ 09:13 PM

State: committed
Milestone: 3.0.6
Assigned to: Aaron Patterson Aaron Patterson
Importance: Low

Activity

  1. Adam Meehan
    Adam Meehan

    Reviewing this code and noticing a few comment about issues on the original commit from github, I realised the dup call on original_time is not necessary. There is no in-place modification of time to effect original_time.

    New patch attached with this change.

    March 1st, 2011 @ 11:14 AM

  2. Adam Meehan
    Adam Meehan

    Another change to remove the reload arg on the timezone aware attribute read method. This argument is undocumented, untested and breaks the before_type_cast behaviour if reload is attempted.

    New patch combining all three changes.

    March 1st, 2011 @ 11:21 AM

  3. Aaron Patterson
    Aaron Patterson
    • State changed from new to open
    • Milestone set to 3.0.6
    • Assigned user set to Aaron Patterson
    • Importance changed from to Low

    March 1st, 2011 @ 04:34 PM

  4. Aaron Patterson
    Aaron Patterson
    • State changed from open to committed

    Applied and pushed. Thanks!

    March 23rd, 2011 @ 11:04 PM

  5. bingbing