I am an active member of Ruby community. I have been consistently contributing to Ruby on Rails for a number of years and now am one of the top 30 contributors to Ruby on Rails. I also help as co-editor for the This week in Rails newsletter. Besides Ruby on Rails I have also contributed to many other notable open source projects including Sinatra, Devise and Rake. I am a seasoned speaker an have spoken at many conferences around the world including Gogaruco in San Francisco, RedDotRubyConf in Singapore, RubyConfIndia in Goa, India MadisonPlusRuby in Madison, Wisconsin, RubyConfBrazil in Suo Paulo, Brazil, and RubyConf Philippines in Manilla, Philippines. I am organizer of Deccan Ruby Conference and used to run RubyIndia Podcast. During my early days of open source as part of "Google summer of code" I contributed to the krypt-project project. Later I helped mentor in the JRuby and currently mentor in the Ruby on Rails organization for Google summer of code. When not working on Ruby, I am mostly working on Reactjs. I have authored the book Building Modern Web Applications with React.js which is published by PACKT. I have produced a number of screencasts on the topic of Learn React.js.
2 minute read
Rails 6 now preserves timezones for Active Job.
It records what the current timezone in effect was
when the job was enqueued
and then restores when the job is executed.
Before
When using an application in different timezones,
it can get tricky to handle timezones,
on Rails Request level, passing to background jobs and more.
In one of our applications,
we allow users to create tasks that can be
assigned a due at date.
This date can take
“today”, “tomorrow”, etc relative date values,
which are also relative
to the timezone
the user is accessing the Application in.
We process this task creation in a background job
as it has some extra work
that it needs to take care of after creating the task.
After
After changes in Rails 6 for ActiveJob,
passing timezone to Job,
is taken care of, by Rails itself.
Propagation to children
This kind of timezone propagation is also useful,
when calling Jobs in a nested fashion.
We don’t need to make sure or take care of,
passing the timezone
to all subsequent nested Jobs.
More useful ENV settings from Active Job
Apart from timezone, Rails already supported
propagating the current locale
when the Job is Enqueued