浏览代码

Set time zone after Rails initializes

Andrew Kane 9 年之前
父节点
当前提交
e8c301a2b4
共有 2 个文件被更改,包括 3 次插入2 次删除
  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