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.

Timezone aware attributes fail with nil assignments

#6367

The "automagic" timezone conversion fails when you assign nil to a timezone aware attribute, for example:

some_model.created_at = nil

And got an ugly "TypeError: can't dup NilClass". I made an awesome and creative fix, check if the argument is nil =)

I also add a test so this will not append again.

Regards.

Reported by Franco Catena · February 3rd, 2011 @ 02:15 PM

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

Activity

  1. Franco Catena
    Franco Catena
    • Tag changed from active_record, rails, timewithzone, timezone to activerecord 3.0.4rc1 patch, patch rails 3.1.0.beta, 3.0, active_record, rails, rails3.1, timewithzone, timezone

    February 3rd, 2011 @ 06:51 PM

  2. Franco Catena
    Franco Catena
    • Tag changed from activerecord 3.0.4rc1 patch, patch rails 3.1.0.beta, 3.0, active_record, rails, rails3.1, timewithzone, timezone to activerecord 3.0.4rc1 patch, patch rails 3.1.0.beta, 3.0, active_record, patch, rails, rails3.1, timewithzone, timezone
    • Assigned user set to Aaron Patterson

    After reading Ticket Assignment doc =)

    February 4th, 2011 @ 12:51 AM

  3. eagle.anton (at gmail)
    eagle.anton (at gmail)

    I can confirm this bug. Patch solves the problem.

    February 7th, 2011 @ 01:11 PM

  4. eagle.anton (at gmail)
    eagle.anton (at gmail)

    It seems like that is fixed in rails master here but rails-3-stable still isn't patched.

    February 9th, 2011 @ 09:52 AM

  5. Franco Catena
    Franco Catena

    Yes, is fixed in master (through a pull not a ticket), I asume this ticket is pseudo stale, except for the fact that the other patch is not backported to 3-0-stable.

    February 9th, 2011 @ 01:30 PM

  6. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to committed
    • Importance changed from to Low

    Hey thanks for letting us know guys I've just backported it.

    February 12th, 2011 @ 04:00 PM