Rails 5 deprecation warning and adding code to initializers?

ruby-on-rails

Solution

add to `config/application.rb` inside `class Application < Rails::Application` this line:

config.active_record.time_zone_aware_types = [:datetime, :time]

Problem

To which initializer file should I add the desired line of code? I'm getting the following deprecation warning. DEPRECATION WARNING: 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] ``` I'm a rails newbie, I just want to follow best practice. Thanks!

Original source