From 6f03b75f007791d62ed863ce592861c922990462 Mon Sep 17 00:00:00 2001 From: nilsding Date: Fri, 28 Nov 2014 21:18:20 +0100 Subject: [PATCH] fixed privileged? method --- app/controllers/application_controller.rb | 2 +- app/helpers/application_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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