diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-28 23:45:01 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-29 17:53:03 -0500 |
commit | 41e177ee069e1ef93b51624ddde2fa5fcf6c8e94 (patch) | |
tree | 4c427cfe72a786bf933833dadd73cc89b356d239 /activerecord/lib/active_record/attribute_methods | |
parent | 09cac8c67afdc4b2a1c6ae07931ddc082629b277 (diff) | |
download | rails-41e177ee069e1ef93b51624ddde2fa5fcf6c8e94.tar.gz rails-41e177ee069e1ef93b51624ddde2fa5fcf6c8e94.tar.bz2 rails-41e177ee069e1ef93b51624ddde2fa5fcf6c8e94.zip |
Set time as a timezone aware type and remove related deprecation
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb index 500d903857..df1231ad47 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -63,7 +63,7 @@ module ActiveRecord self.skip_time_zone_conversion_for_attributes = [] class_attribute :time_zone_aware_types, instance_writer: false - self.time_zone_aware_types = [:datetime, :not_explicitly_configured] + self.time_zone_aware_types = [:datetime, :time] end module ClassMethods @@ -86,29 +86,8 @@ module ActiveRecord def create_time_zone_conversion_attribute?(name, cast_type) enabled_for_column = time_zone_aware_attributes && !skip_time_zone_conversion_for_attributes.include?(name.to_sym) - result = enabled_for_column && - time_zone_aware_types.include?(cast_type.type) - if enabled_for_column && - !result && - cast_type.type == :time && - time_zone_aware_types.include?(:not_explicitly_configured) - ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc) - Time columns will become time zone aware in Rails 5.1. This - still causes `String`s to be parsed as if they were in `Time.zone`, - and `Time`s to be converted to `Time.zone`. - - To keep the old behavior, you must add the following to your initializer: - - config.active_record.time_zone_aware_types = [:datetime] - - To silence this deprecation warning, add the following: - - config.active_record.time_zone_aware_types = [:datetime, :time] - MESSAGE - end - - result + enabled_for_column && time_zone_aware_types.include?(cast_type.type) end end end |