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] ActiveRecord does not write invalid datetime and timestamp data when enable time zone support

#3630

Suppose I have a model "Event" with datetime and timestamp attributes, and we assign invalid data to them:

ActiveRecord::Base.time_zone_aware_attributes
=> true
e = Event.new( :datetime => "AAA", :timestamp => "BBB", :integer => "CCC" )
e.attributes_before_type_cast
=> { "datetime" => nil, "timestamp" => nil, "integer" => "CCC" }

Expect:

=> { "datetime" => "AAA", "timestamp" => "BBB", "integer" => "CCC }

BTW, the result is right if we disable time zone support:

ActiveRecord::Base.time_zone_aware_attributes = false
e = Event.new( :datetime => "AAA", :timestamp => "BBB", :integer => "CCC" )
e.attributes_before_type_cast
=> { "datetime" => "AAA", "timestamp" => "BBB", "integer" => "CCC }

Reported by ihower · December 29th, 2009 @ 09:39 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. ihower
    ihower
    • Tag set to 2-3-stable

    December 29th, 2009 @ 09:46 PM

  2. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to Low

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 8th, 2010 @ 12:32 PM