diff --git a/app/controllers/searches_controller.rb b/app/controllers/searches_controller.rb index 5176cea02..b1ec5a0d2 100644 --- a/app/controllers/searches_controller.rb +++ b/app/controllers/searches_controller.rb @@ -2,10 +2,12 @@ class SearchesController < ApplicationController include Turbo::DriveHelper def show - if card = Current.user.accessible_cards.find_by_id(params[:q]) + @query = params[:q].blank? ? nil : params[:q] + + if card = Current.user.accessible_cards.find_by_id(@query) @card = card else - set_page_and_extract_portion_from Current.user.search(params[:q]) + set_page_and_extract_portion_from Current.user.search(@query) @recent_search_queries = Current.user.search_queries.order(updated_at: :desc).limit(10) end end diff --git a/app/views/searches/_results.html.erb b/app/views/searches/_results.html.erb index 0b622e95d..19c5b90fb 100644 --- a/app/views/searches/_results.html.erb +++ b/app/views/searches/_results.html.erb @@ -1,6 +1,6 @@