diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2018-02-22 16:41:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-22 16:41:26 +0000 |
commit | f85c77bef9efd8ffa97a59e87320e55e486e30c2 (patch) | |
tree | 3c44b3d0c7068dd1d77726aef50e2862e3cb8a06 /activejob/lib/active_job/core.rb | |
parent | e20742f12b362676e8f69fe68c3193ad80a90172 (diff) | |
parent | a9d1167b1fdae6f5f5496738b3e7d1e05949dcd0 (diff) | |
download | rails-f85c77bef9efd8ffa97a59e87320e55e486e30c2.tar.gz rails-f85c77bef9efd8ffa97a59e87320e55e486e30c2.tar.bz2 rails-f85c77bef9efd8ffa97a59e87320e55e486e30c2.zip |
Merge pull request #32085 from rails/add-timezone-support-to-activejob
Add support for timezones to Active Job
Diffstat (limited to 'activejob/lib/active_job/core.rb')
-rw-r--r-- | activejob/lib/active_job/core.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activejob/lib/active_job/core.rb b/activejob/lib/active_job/core.rb index 879746fc01..da841ae45b 100644 --- a/activejob/lib/active_job/core.rb +++ b/activejob/lib/active_job/core.rb @@ -31,6 +31,9 @@ module ActiveJob # I18n.locale to be used during the job. attr_accessor :locale + + # Timezone to be used during the job. + attr_accessor :timezone end # These methods will be included into any Active Job object, adding @@ -87,7 +90,8 @@ module ActiveJob "priority" => priority, "arguments" => serialize_arguments(arguments), "executions" => executions, - "locale" => I18n.locale.to_s + "locale" => I18n.locale.to_s, + "timezone" => Time.zone.try(:name) } end @@ -125,6 +129,7 @@ module ActiveJob self.serialized_arguments = job_data["arguments"] self.executions = job_data["executions"] self.locale = job_data["locale"] || I18n.locale.to_s + self.timezone = job_data["timezone"] || Time.zone.try(:name) end private |