2014-11-13 2 views

답변

1

active_record_delayed_job을 사용하는 경우 application.rb에 설정된 응용 프로그램 표준 시간대가 사용됩니다.

는 delayed_job 소스 (https://github.com/collectiveidea/delayed_job_active_record/blob/master/lib/delayed/backend/active_record.rb#L97)

# Get the current time (GMT or local depending on DB) 
    # Note: This does not ping the DB to get the time, so all your clients 
    # must have syncronized clocks. 
    def self.db_time_now 
     if Time.zone 
     Time.zone.now 
     elsif ::ActiveRecord::Base.default_timezone == :utc 
     Time.now.utc 
     else 
     Time.now 
     end 
    end 

에서 가져 팔로우이 가능한 작업에 대한 DB를 조회 reserve_with_scope에 사용되는 당신이 어떤 시간대 확실하지 않은 경우

(라인 56 년부터) 응용 프로그램에서 설정, 당신은 레일 콘솔에서 다음을 사용할 수 있습니다

2.1.4 :005 > Rails.application.config.time_zone 
=> "Helsinki" 

또는

2.1.4 :007 > Time.zone.name 
=> "Helsinki" 
관련 문제