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
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if report = Report.where(id: params[:id]).first
|
if (report = Report.where(id: params[:id]).first) && report.destroy_reported_item
|
||||||
if report.destroy_reported_item
|
flash[:notice] = I18n.t 'report.status.destroyed'
|
||||||
flash[:notice] = I18n.t 'report.status.destroyed'
|
|
||||||
else
|
|
||||||
flash[:error] = I18n.t 'report.status.failed'
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
flash[:error] = I18n.t 'report.status.failed'
|
flash[:error] = I18n.t 'report.status.failed'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue