This project is archived and is in readonly mode.
[PATCH] ActiveRecord does not write invalid datetime and timestamp data when enable time zone support
Reported by ihower | December 29th, 2009 @ 09:39 PM
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 }
Comments and changes to this ticket
-
ihower December 29th, 2009 @ 09:46 PM
- Tag set to 2-3-stable
-
Rohit Arondekar October 8th, 2010 @ 12:32 PM
- 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.
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>