From 1ddbc24a8b6adab78d5452cda33c80ec76d76495 Mon Sep 17 00:00:00 2001 From: Pedro Costa Date: Sun, 28 Oct 2018 18:35:36 +0000 Subject: [PATCH] Fix default time zone config Why: * Starting the environment, even with just `bundle exec rake`, results in the following error: ```sh Value assigned to config.time_zone not recognized.Run "rake -D time" for a list of tasks for finding appropriate time zone names. ``` This change addresses the issue by: * Adding the time zone setting to environment specific configurations, defaulting to UTC in development, and using Melbourne in tests. --- config/environments/development.rb | 6 ++++++ config/environments/test.rb | 2 ++ 2 files changed, 8 insertions(+) diff --git a/config/environments/development.rb b/config/environments/development.rb index 22bf2a1945..70e48c9aac 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -29,6 +29,12 @@ Openfoodnetwork::Application.configure do # Expands the lines which load the assets config.assets.debug = false + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # + # To override this, set the appropriate locale in application.yml + config.time_zone = ENV.fetch("TIMEZONE", "UTC") + config.i18n.fallbacks = [:en] # Show emails using Letter Opener diff --git a/config/environments/test.rb b/config/environments/test.rb index 7ecc7ae3c2..299e2d9c19 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -33,6 +33,8 @@ Openfoodnetwork::Application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + config.time_zone = ENV.fetch("TIMEZONE", "Melbourne") + # Tests assume English text on the site. config.i18n.default_locale = "en" config.i18n.available_locales = ['en', 'es']