diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index ee27b61..d3f433d 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -48,10 +48,11 @@ def remove_profile def set_reportable_for_new reportable_id = params[:reportable] - @reportable = Post.find(reportable_id) if params[:reportable_type] == 'Post' - @reportable = Profile.friendly.find(reportable_id) if params[:reportable_type] == 'Profile' - @reportable = Comment.find(reportable_id) if params[:reportable_type] == 'Comment' - @reportable = Reply.find(reportable_id) if params[:reportable_type] == 'Reply' + reportable_type = params[:reportable_type] + @reportable = Post.find(reportable_id) if reportable_type == 'Post' + @reportable = Profile.friendly.find(reportable_id) if reportable_type == 'Profile' + @reportable = Comment.find(reportable_id) if reportable_type == 'Comment' + @reportable = Reply.find(reportable_id) if reportable_type == 'Reply' end def set_reportable_for_create