Skip to content

Commit 96d6993

Browse files
committed
Only lookup_protip on controller if the param :id is present
1 parent b9fe0f8 commit 96d6993

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/controllers/protips_controller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,11 @@ def expand_query(query_string)
430430
end
431431

432432
def lookup_protip
433-
@protip = Protip.find_by_public_id(params.permit(:id)[:id].downcase)
433+
@protip = if public_id = params[:id]
434+
Protip.find_by_public_id(public_id.downcase)
435+
else
436+
nil
437+
end
434438
end
435439

436440
def choose_protip_layout

0 commit comments

Comments
 (0)