aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/CHANGELOG.md
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2019-01-21 20:26:45 +0000
committerGitHub <noreply@github.com>2019-01-21 20:26:45 +0000
commit4f62e757caf608d30d46ee745f4f666fb8eba2a7 (patch)
treefe09316da3912e930f9cf512c5d8b35bc91a075a /activemodel/CHANGELOG.md
parentfeb97dfabd027a73a41ca8bd2ab7c3196ab76d3d (diff)
parentccdedeb9d5e1b2b74f03baef65aa8198b456e3b0 (diff)
downloadrails-4f62e757caf608d30d46ee745f4f666fb8eba2a7.tar.gz
rails-4f62e757caf608d30d46ee745f4f666fb8eba2a7.tar.bz2
rails-4f62e757caf608d30d46ee745f4f666fb8eba2a7.zip
Merge pull request #34990 from rails/fix-time-multiparameter-casting
Fix year value when casting a multiparameter time hash
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r--activemodel/CHANGELOG.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md
index 571c050f2f..912b307683 100644
--- a/activemodel/CHANGELOG.md
+++ b/activemodel/CHANGELOG.md
@@ -1,3 +1,31 @@
+* Fix year value when casting a multiparameter time hash
+
+ When assigning a hash to a time attribute that's missing a year component
+ (e.g. a `time_select` with `:ignore_date` set to `true`) then the year
+ defaults to 1970 instead of the expected 2000. This results in the attribute
+ changing as a result of the save.
+
+ Before:
+ ```
+ event = Event.new(start_time: { 4 => 20, 5 => 30 })
+ event.start_time # => 1970-01-01 20:30:00 UTC
+ event.save
+ event.reload
+ event.start_time # => 2000-01-01 20:30:00 UTC
+ ```
+
+ After:
+ ```
+ event = Event.new(start_time: { 4 => 20, 5 => 30 })
+ event.start_time # => 2000-01-01 20:30:00 UTC
+ event.save
+ event.reload
+ event.start_time # => 2000-01-01 20:30:00 UTC
+ ```
+
+ *Andrew White*
+
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
* Add `ActiveModel::Errors#of_kind?`.