Files
fizzy/app/controllers/concerns/current_timezone.rb
T
Jorge Manrubia cfa0149564 Persist timezones in the server
Add a beacon to persist timezones when these change (or the first time)
2025-09-05 12:11:57 +02:00

20 lines
392 B
Ruby

module CurrentTimezone
extend ActiveSupport::Concern
included do
around_action :set_current_timezone
helper_method :timezone_from_cookie
end
private
def set_current_timezone(&)
Time.use_zone(timezone_from_cookie, &)
end
def timezone_from_cookie
timezone = cookies[:timezone]
ActiveSupport::TimeZone[timezone] if timezone.present?
end
end