Bladeren bron

Set time zone after Rails initializes

Andrew Kane 9 jaren geleden
bovenliggende
commit
e8c301a2b4
2 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 0 1
      lib/blazer.rb
  2. 3 1
      lib/blazer/engine.rb

+ 0 - 1
lib/blazer.rb

@@ -19,5 +19,4 @@ module Blazer
   def self.time_zone=(time_zone)
     @time_zone = time_zone.is_a?(ActiveSupport::TimeZone) ? time_zone : ActiveSupport::TimeZone[time_zone.to_s]
   end
-  self.time_zone = Time.zone
 end

+ 3 - 1
lib/blazer/engine.rb

@@ -2,9 +2,11 @@ module Blazer
   class Engine < ::Rails::Engine
     isolate_namespace Blazer
 
-    initializer "precompile" do |app|
+    initializer "blazer" do |app|
       # use a proc instead of a string
       app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/application\.(js|css)\z/ }
+
+      Blazer.time_zone = Time.zone
     end
   end
 end