From e510a6e8b445def99d4df635efea88427d401c8e Mon Sep 17 00:00:00 2001 From: Yuki Date: Fri, 18 Sep 2015 18:09:26 +0900 Subject: [PATCH] Do you feel it, Mr. Krabs? --- app/controllers/ajax/report_controller.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/controllers/ajax/report_controller.rb b/app/controllers/ajax/report_controller.rb index 451b86ba..05cca16c 100644 --- a/app/controllers/ajax/report_controller.rb +++ b/app/controllers/ajax/report_controller.rb @@ -29,13 +29,13 @@ class Ajax::ReportController < ApplicationController when 'User' User.find_by_screen_name params[:id] when 'Question' - Question + Question.find params[:id] when 'Answer' - Answer + Answer.find params[:id] when 'Comment' - Comment + Comment.find params[:id] else - Answer + Answer.find params[:id] end if object.nil? @@ -43,11 +43,7 @@ class Ajax::ReportController < ApplicationController return end - if obj == 'User' - current_user.report object, params[:reason] - else - current_user.report object.find(params[:id]), params[:reason] - end + current_user.report object, params[:reason] @status = :okay @message = I18n.t('messages.report.create.okay', parameter: params[:type])