lib/active_support.rb in activesupport-7.2.2 vs lib/active_support.rb in activesupport-8.0.0.beta1

- old
+ new

@@ -56,14 +56,16 @@ autoload :SecureCompareRotator eager_autoload do autoload :BacktraceCleaner autoload :ProxyObject + autoload :Benchmark autoload :Benchmarkable autoload :Cache autoload :Callbacks autoload :Configurable + autoload :ClassAttribute autoload :Deprecation autoload :Delegation autoload :Digest autoload :ExecutionContext autoload :Gzip @@ -113,12 +115,18 @@ def self.to_time_preserves_timezone DateAndTime::Compatibility.preserve_timezone end def self.to_time_preserves_timezone=(value) - unless value + if !value ActiveSupport.deprecator.warn( - "Support for the pre-Ruby 2.4 behavior of to_time has been deprecated and will be removed in Rails 8.0." + "`to_time` will always preserve the receiver timezone rather than system local time in Rails 8.0. " \ + "To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`." + ) + elsif value != :zone + ActiveSupport.deprecator.warn( + "`to_time` will always preserve the full timezone rather than offset of the receiver in Rails 8.0. " \ + "To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`." ) end DateAndTime::Compatibility.preserve_timezone = value end