From c107cb19cbc97fd1dd157a8942d8cfde9297246a Mon Sep 17 00:00:00 2001 From: Yuki Date: Fri, 18 Sep 2015 18:08:08 +0900 Subject: [PATCH] LEEDLE LEEDLE LEEE --- app/controllers/ajax/report_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/ajax/report_controller.rb b/app/controllers/ajax/report_controller.rb index 399e5c12..451b86ba 100644 --- a/app/controllers/ajax/report_controller.rb +++ b/app/controllers/ajax/report_controller.rb @@ -25,7 +25,7 @@ class Ajax::ReportController < ApplicationController obj = params[:type].strip.capitalize - object = case params[:type].strip.capitalize + object = case obj when 'User' User.find_by_screen_name params[:id] when 'Question' @@ -43,7 +43,11 @@ class Ajax::ReportController < ApplicationController return end - current_user.report object.find(params[:id]), params[:reason] + if obj == 'User' + current_user.report object, params[:reason] + else + current_user.report object.find(params[:id]), params[:reason] + end @status = :okay @message = I18n.t('messages.report.create.okay', parameter: params[:type])