https://github.com/agency-of-learning/PairApp/issues/30
“We want to be able to store the timezone on a User.”
Store timezone:
Add :time_zone to the User model
create_table :users do |t|
t.string :time_zone, default: "UTC"
...
end
Add helper to profile form to allow user to set own desired time zone
<%= f.input :time_zone %>
In the ApplicationController set an around_action
around_action :set_time_zone, if: :current_user
private
def set_time_zone(&block)
Time.use_zone(current_user.time_zone, &block)
end