Last active
August 29, 2015 14:04
-
-
Save r38y/3cda57ba18305801bb4c to your computer and use it in GitHub Desktop.
Set timezone method that sets the time zone back after the request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
around_action :set_timezone | |
def set_timezone | |
old_time_zone = Time.zone | |
Time.zone = current_user.time_zone | |
yield | |
ensure | |
Time.zone = old_time_zone | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment