Fixed error in group_serializer if no current_user defined

• Fixed:
- error in group_serializer if no current_user defined
This commit is contained in:
mgabdev 2020-09-14 11:44:01 -05:00
parent 91a62bb3b5
commit 20ef23659c

View File

@ -16,7 +16,7 @@ class REST::GroupSerializer < ActiveModel::Serializer
end
def password
if current_user && object.group_accounts.where(account_id: current_user.account.id, role: :admin).exists?
if defined?(current_user) && object.group_accounts.where(account_id: current_user.account.id, role: :admin).exists?
object.password
else
nil