Skip to content

Commit 7c971b6

Browse files
committed
returns nil instead of active record error
1 parent ccb99db commit 7c971b6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/helpers/application_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ def rank_badge(user)
2121
admin_icon = fa_icon 'tools', text: ' Staff'
2222
banned_icon = fa_icon 'ban', text: ' Suspended'
2323
curator_icon = fa_icon 'hands-helping', text: ' Curator'
24-
24+
2525
id = user
26-
user = User.find(user.to_i) if id.class == String || id.class == Integer
26+
id_not_object = (id.instance_of? String) || (id.instance_of? Integer)
27+
user = User.find_by(id: id.to_i) if id_not_object
2728
return if user.nil?
2829

2930
if user.deactivated?

0 commit comments

Comments
 (0)