From 9e0973d65fdcac7ce81a4e6fa0d19e2b09315ddd Mon Sep 17 00:00:00 2001 From: Alexandre Arias <apa13@inf.ufpr.br> Date: Thu, 19 Nov 2015 10:40:07 -0200 Subject: [PATCH] fix when roles is nil Signed-off-by: Alexandre Arias <apa13@inf.ufpr.br> --- app/controllers/management/users_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index 8419c88f..d223f2f7 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -76,7 +76,9 @@ class Management::UsersController < ManagementController @curators = Array.new @users = User.includes(:roles).all @users.all.each do |user| - @curators << user if user.roles[0].name == "curator" + if !user.roles[0].nil? + @curators << user if user.roles[0].name == "curator" || [] + end end end @@ -84,7 +86,9 @@ class Management::UsersController < ManagementController @admins = Array.new @users = User.includes(:roles).all @users.all.each do |user| - @admins << user if user.roles[0].name == "admin" + if !user.roles[0].nil? + @admins << user if user.roles[0].name == "admin" || [] + end end end -- GitLab