Module | ActiveSupport::CoreExtensions::Time::Zones::ClassMethods |
In: |
lib/active_support/core_ext/time/zones.rb
|
zone_default | [RW] |
Allows override of Time.zone locally inside supplied block; resets Time.zone to existing value when done.
Sets Time.zone to a TimeZone object for the current request/thread.
This method accepts any of the following:
Here‘s an example of how you might set Time.zone on a per request basis — current_user.time_zone just needs to return a string identifying the user‘s preferred TimeZone:
class ApplicationController < ActionController::Base before_filter :set_time_zone def set_time_zone Time.zone = current_user.time_zone end end