From 96d6993b353a4aa709ec9729f319c4a3888af400 Mon Sep 17 00:00:00 2001 From: Mike Hall Date: Fri, 18 Jul 2014 23:16:36 -0500 Subject: [PATCH] Only lookup_protip on controller if the param :id is present --- app/controllers/protips_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/protips_controller.rb b/app/controllers/protips_controller.rb index 9aebd421..f767338a 100644 --- a/app/controllers/protips_controller.rb +++ b/app/controllers/protips_controller.rb @@ -430,7 +430,11 @@ def expand_query(query_string) end def lookup_protip - @protip = Protip.find_by_public_id(params.permit(:id)[:id].downcase) + @protip = if public_id = params[:id] + Protip.find_by_public_id(public_id.downcase) + else + nil + end end def choose_protip_layout