This project is archived and is in readonly mode.

#6367 ✓committed
Franco Catena

Timezone aware attributes fail with nil assignments

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

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.

Comments and changes to this ticket

  • Franco Catena

    Franco Catena February 3rd, 2011 @ 06:51 PM

    • 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
  • Franco Catena

    Franco Catena February 4th, 2011 @ 12:51 AM

    • 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 =)

  • eagle.anton (at gmail)

    eagle.anton (at gmail) February 7th, 2011 @ 01:11 PM

    I can confirm this bug. Patch solves the problem.

  • eagle.anton (at gmail)

    eagle.anton (at gmail) February 9th, 2011 @ 09:52 AM

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

  • Franco Catena

    Franco Catena February 9th, 2011 @ 01:30 PM

    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.

  • Santiago Pastorino

    Santiago Pastorino February 12th, 2011 @ 04:00 PM

    • State changed from “new” to “committed”
    • Importance changed from “” to “Low”

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

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>

Pages