app/controllers/concerns/voluntary/v1/base_controller.rb in voluntary-0.6.0 vs app/controllers/concerns/voluntary/v1/base_controller.rb in voluntary-0.7.0

- old
+ new

@@ -8,10 +8,12 @@ rescue_from ActiveRecord::RecordNotFound, with: :not_found rescue_from Mongoid::Errors::DocumentNotFound, with: :not_found helper_method :parent, :application_navigation, :navigation_product_path, :navigation_product_name, :voluntary_application_stylesheets helper_method :voluntary_application_javascripts + + before_filter :set_timezone end def voluntary_application_stylesheets ['voluntary/application', 'application'] end @@ -74,9 +76,13 @@ def response_with_standard(format = nil, error = nil) render status: error ? 500 : 200, json: { success: error ? false : true, error: error} and return true end private + + def set_timezone + Time.zone = current_user.try(:timezone).present? ? current_user.timezone : 'UTC' + end def current_namespace controller_name_segments = params[:controller].split('/') controller_name_segments.pop controller_namespace = controller_name_segments.join('/').downcase \ No newline at end of file