Processing requests using the user's time zone I have an application in Ruby on Rails (3.2) and I want all the requests to take into account the currently logged in user's time zone. Also, I want to have a helper that will let me display date time fields using user's time zone.

I follow this approach:


Inside ApplicationController I hook an around_filter like this:

around_filter :user_time_zone, if: :current_user

The implementation of user_time_zone is:

def user_time_zone(&amp;block)
  Time.use_zone(current_user.time_zone, &amp;block)
end

In ApplicationController as well, I have a helper method like so:

helper_method :datetime_users_time_zone


with implementation:

def datetime_users_time_zone(datetime, user = nil)
  time_zone = user.present? ? user.time_zone : Time.zone_default
  datetime.in_time_zone(time_zone)
end



Is this good practice and implementation? What might be the gotchas? If I were to implement this for Rails 4, what changes should I make?
If your usecase is displaying localized time in views then please handle it in frontend, i.e. using http://timeago.yarp.com/ 

Handling timezone in backend will be big pain when you try to add caching (you will need to cache same piece of content for each timezone).