Skip to content

Commit 0456f72

Browse files
committed
returns nil without active record error
1 parent 7c971b6 commit 0456f72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/helpers/application_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def username(user_str)
8080
user_id = user_str.to_i
8181
return 'you' if user_id && current_user && user_id == current_user.id
8282

83-
user = User.find(user_id)
83+
user = User.find_by(id: user_id)
8484
return raw user.username + ' <sup>(' + user.id.to_s + ')</sup>' || 'user ' + user.id.to_s if user&.username && user&.id
8585

8686
user_str

0 commit comments

Comments
 (0)