Skip to content

Commit a5d2bd4

Browse files
committed
Merge pull request #72 from assemblymade/lookup_protip_downcase_nil
Only lookup_protip on controller if the param :id is present
2 parents 3d7e5e8 + 96d6993 commit a5d2bd4

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)