Joined if statements and removed duplicated code
This commit is contained in:
parent
512d96bda6
commit
045ced0518
1 changed files with 2 additions and 6 deletions
|
|
@ -14,12 +14,8 @@ class ReportController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
if report = Report.where(id: params[:id]).first
|
||||
if report.destroy_reported_item
|
||||
flash[:notice] = I18n.t 'report.status.destroyed'
|
||||
else
|
||||
flash[:error] = I18n.t 'report.status.failed'
|
||||
end
|
||||
if (report = Report.where(id: params[:id]).first) && report.destroy_reported_item
|
||||
flash[:notice] = I18n.t 'report.status.destroyed'
|
||||
else
|
||||
flash[:error] = I18n.t 'report.status.failed'
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue