class Time

def use_zone(time_zone)

the application's default timezone.
attributes that have been read before the block will remain in
objects that have already been created, e.g. any model timestamp
NOTE: This won't affect any ActiveSupport::TimeWithZone

end
end
Time.use_zone(current_user.timezone) { yield }
def set_time_zone
private

around_action :set_time_zone
class ApplicationController < ActionController::Base

resets Time.zone to existing value when done.
Allows override of Time.zone locally inside supplied block;
def use_zone(time_zone)
  new_zone = find_zone!(time_zone)
  begin
    old_zone, ::Time.zone = ::Time.zone, new_zone
    yield
  ensure
    ::Time.zone = old_zone
  end
end