Refactored code to reduce number of database queries (#960)

This commit is contained in:
Ahmad Farhat
2020-02-24 12:31:30 -05:00
committed by GitHub
parent 92da1f6f87
commit 2cc1fdf281
14 changed files with 81 additions and 52 deletions

View File

@ -293,7 +293,7 @@ class RoomsController < ApplicationController
# Find the room from the uid.
def find_room
@room = Room.find_by!(uid: params[:room_uid])
@room = Room.includes(:owner).find_by!(uid: params[:room_uid])
end
# Ensure the user either owns the room or is an admin of the room owner or the room is shared with him