Check if post or comment exist while rendering
It is possible that the item was deleted during the time it was reported and the admin review Signed-off-by: Lukas Matt <lukas@zauberstuhl.de>
This commit is contained in:
parent
95072d6010
commit
a6c3f67ba2
1 changed files with 4 additions and 1 deletions
|
|
@ -7,7 +7,10 @@ class ReportController < ApplicationController
|
|||
before_action :redirect_unless_moderator, except: [:create]
|
||||
|
||||
def index
|
||||
@reports = Report.where(reviewed: false)
|
||||
@reports ||= []
|
||||
Report.where(reviewed: false).each do |report|
|
||||
@reports << report unless report.item.nil?
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
|||
Loading…
Reference in a new issue