mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Fix deprecation warning for to_time
Warning was: > DEPRECATION WARNING: `to_time` will always preserve the full timezone > rather than offset of the receiver in Rails 8.1. To opt in to the new > behavior, set `config.active_support.to_time_preserves_timezone = > :zone`. Actually we were already using `:zone`, but it was set in a file required late in the loading process. Moving it to `config/application.rb` fixes the deprecation warning.
This commit is contained in:
@@ -167,6 +167,13 @@ module OpenProject
|
||||
# Include tstzrange columns in the list of time zone aware types
|
||||
ActiveRecord::Base.time_zone_aware_types += [:tstzrange]
|
||||
|
||||
# Specifies whether `to_time` methods preserve the UTC offset of their receivers
|
||||
# or preserves the timezone. Rails 8.0+ default is `:zone`.
|
||||
# If set to `:zone`, `to_time` methods will use the timezone of their receivers.
|
||||
# If set to `:offset`, `to_time` methods will use the UTC offset.
|
||||
# If `false`, `to_time` methods will convert to the local system UTC offset instead.
|
||||
config.active_support.to_time_preserves_timezone = :zone
|
||||
|
||||
# Activate being able to specify the format in which full_message works.
|
||||
# Doing this, it is e.g. possible to avoid having the format of '%{attribute} %{message}' which
|
||||
# will always prepend the attribute name to the error message.
|
||||
|
||||
@@ -39,14 +39,6 @@
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
||||
|
||||
###
|
||||
# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone.
|
||||
# If set to `:zone`, `to_time` methods will use the timezone of their receivers.
|
||||
# If set to `:offset`, `to_time` methods will use the UTC offset.
|
||||
# If `false`, `to_time` methods will convert to the local system UTC offset instead.
|
||||
#++
|
||||
Rails.application.config.active_support.to_time_preserves_timezone = :zone
|
||||
|
||||
###
|
||||
# When both `If-Modified-Since` and `If-None-Match` are provided by the client
|
||||
# only consider `If-None-Match` as specified by RFC 7232 Section 6.
|
||||
|
||||
Reference in New Issue
Block a user