diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e5330054f..120a3cd66 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base helper_method :sort_direction, :sort_column before_filter :init_gon skip_before_filter :verify_authenticity_token + around_filter :set_time_zone, if: :current_user rescue_from CanCan::AccessDenied do |exception| unless current_user @@ -275,4 +276,8 @@ def not_found helper_method :masquerading? helper_method :curr_user_course #helper_method :fb_liked? + + def set_time_zone(&block) + Time.use_zone(current_user.try(:time_zone), &block) + end end diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index beb1de502..648a068f6 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -17,6 +17,7 @@ <%= simple_form_for current_user, url: users_update_path, html: {class: "form-horizontal"} do |f| %> <%= f.input :name %> + <%= f.input :time_zone %> <%= f.input :use_uploaded_picture, as: :boolean %>