These are chat archives for dry-rb/chat

23rd
Aug 2017
Alexander
@cutalion
Aug 23 2017 14:32
hi there!

could somebody help me to include activesupport time into the dry-system project?
I put the following file into the system/boot directory, but this does not seem threadsafe.

# system/boot/time_zone.rb
require 'active_support/time'
Time.zone = MyApp.config.time_zone

MyApp is my main container

class MyApp < Dry::Web::Container
  setting :time_zone

  configure do |config|
    config.time_zone = 'Moscow'
  end
end
Alexander
@cutalion
Aug 23 2017 14:39
It works fine in tests, but fails in dev environment, running inside puma
it boots up fine, but when I hit code with Time.zone.now it fails with error "undefined method now for nil"
Alexander
@cutalion
Aug 23 2017 14:59
nevermind, I've figured it out. Time.zone is thread specific value. I should use Time.zone_default