Skip to content

Instantly share code, notes, and snippets.

@r38y
Last active August 29, 2015 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r38y/3cda57ba18305801bb4c to your computer and use it in GitHub Desktop.
Save r38y/3cda57ba18305801bb4c to your computer and use it in GitHub Desktop.
Set timezone method that sets the time zone back after the request
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