mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fix datatime error
This commit is contained in:
parent
9ebb3558f4
commit
9bf4583241
3 changed files with 13 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
* Fix an Active Record DateTime field NoMethodError caused by incomplete
|
||||
datetime. [Bug #24195](https://github.com/rails/rails/issues/24195)
|
||||
|
||||
*Sen Zhang*
|
||||
|
||||
* Allow `slice` to take an array of methods (without need for splatting).
|
||||
|
||||
*Cohen Carlisle*
|
||||
|
|
|
@ -39,7 +39,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def set_time_zone_without_conversion(value)
|
||||
::Time.zone.local_to_utc(value).in_time_zone if value
|
||||
::Time.zone.local_to_utc(value).try(:in_time_zone) if value
|
||||
end
|
||||
|
||||
def map_avoiding_infinite_recursion(value)
|
||||
|
|
|
@ -260,6 +260,13 @@ class MultiParameterAttributeTest < ActiveRecord::TestCase
|
|||
topic.attributes = attributes
|
||||
assert_equal Time.zone.local(2000, 1, 1, 16, 24, 0), topic.bonus_time
|
||||
assert_not topic.bonus_time.utc?
|
||||
|
||||
attributes = {
|
||||
"written_on(1i)" => "2000", "written_on(2i)" => "", "written_on(3i)" => "",
|
||||
"written_on(4i)" => "", "written_on(5i)" => ""
|
||||
}
|
||||
topic.attributes = attributes
|
||||
assert_nil topic.written_on
|
||||
end
|
||||
ensure
|
||||
Topic.reset_column_information
|
||||
|
|
Loading…
Reference in a new issue