Fixed 500 caused by room search (#2366)

This commit is contained in:
Ahmad Farhat 2020-12-14 18:15:07 -05:00 committed by GitHub
parent 7809431873
commit 7a2405aa9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -97,6 +97,8 @@ class User < ApplicationRecord
# Returns a list of rooms ordered by last session (with nil rooms last)
def ordered_rooms
return [] if main_room.nil?
[main_room] + rooms.where.not(id: main_room.id).order(Arel.sql("last_session IS NULL, last_session desc"))
end