diff options
author | Xavier Noria <fxn@hashref.com> | 2011-02-05 19:47:08 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-02-05 19:47:08 +0100 |
commit | 8b5dc9caa52a2877e3ecc207515fd156abad45e0 (patch) | |
tree | 1ce25206b88a7fb45ef6e37d1a7c293c31477c02 /activesupport/lib/active_support/core_ext/time/zones.rb | |
parent | 59f7780a3454a14054d1d33d9b6e31192ab2e58b (diff) | |
parent | 277327bb7f389a140eb4ae7722d64d6cf45e06cf (diff) | |
download | rails-8b5dc9caa52a2877e3ecc207515fd156abad45e0.tar.gz rails-8b5dc9caa52a2877e3ecc207515fd156abad45e0.tar.bz2 rails-8b5dc9caa52a2877e3ecc207515fd156abad45e0.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/zones.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/zones.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/zones.rb b/activesupport/lib/active_support/core_ext/time/zones.rb index ef401a6d18..ff90d7ca58 100644 --- a/activesupport/lib/active_support/core_ext/time/zones.rb +++ b/activesupport/lib/active_support/core_ext/time/zones.rb @@ -19,14 +19,18 @@ class Time # * A TZInfo::Timezone object. # * An identifier for a TZInfo::Timezone object (e.g., "America/New_York"). # - # Here's an example of how you might set <tt>Time.zone</tt> on a per request basis -- <tt>current_user.time_zone</tt> - # just needs to return a string identifying the user's preferred TimeZone: + # Here's an example of how you might set <tt>Time.zone</tt> on a per request basis and reset it when the request is done. + # <tt>current_user.time_zone</tt> just needs to return a string identifying the user's preferred time zone: # # class ApplicationController < ActionController::Base - # before_filter :set_time_zone + # around_filter :set_time_zone # # def set_time_zone - # Time.zone = current_user.time_zone + # old_time_zone = Time.zone + # Time.zone = current_user.time_zone if logged_in? + # yield + # ensure + # Time.zone = old_time_zone # end # end def zone=(time_zone) |