0

I am using this setup in config/environments/production.rb:

  config.time_zone = 'Eastern Time (US & Canada)'
  config.active_record.default_timezone = 'Eastern Time (US & Canada)'  

But when I am deploying the application to the server, I am seeing these warning messages:

warning: :database_timezone option must be :utc or :local - defaulting to :local

How to fix this warning? Should I add another config.active_record.default_timezone with :utc?

Rails cannot use the timezone I set above?

Thank you.

1 Answer 1

2

From: http://guides.rubyonrails.org/configuring.html#configuring-active-record

config.time_zone sets the default time zone for the application and enables time zone awareness for Active Record.

config.active_record.default_timezone determines whether to use Time.local (if set to :local) or Time.utc (if set to :utc) when pulling dates and times from the database. The default is :local.

So based on this, if you want to override your default timezone to Eastern time, you'd want to do:

config.time_zone = 'Eastern Time (US & Canada)'
config.active_record.default_timezone = :local

Let me know if this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.