diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 73c86b10..12a5041b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base before_filter :configure_permitted_parameters, if: :devise_controller? def privileged?(user) - (current_user == user || current_user.admin?) ? true : false + (current_user && (current_user == user || current_user.admin?)) ? true : false end protected diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 87e82159..7557456d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -47,6 +47,6 @@ module ApplicationHelper end def privileged?(user) - (current_user == user || current_user.admin?) ? true : false + (current_user && (current_user == user || current_user.admin?)) ? true : false end end