diff --git a/app/controllers/searches_controller.rb b/app/controllers/searches_controller.rb index 2fba80b35..6441b7592 100644 --- a/app/controllers/searches_controller.rb +++ b/app/controllers/searches_controller.rb @@ -1,11 +1,13 @@ class SearchesController < ApplicationController + before_action :set_query_terms + def show - @search_results = Current.user.search(query_param).limit(50) + @search_results = Current.user.search(@query_terms).limit(50) @recent_search_queries = Current.user.search_queries.order(created_at: :desc).limit(10) end private - def query_param - params[:q] + def set_query_terms + @query_terms = params[:q] end end diff --git a/app/views/searches/_form.html.erb b/app/views/searches/_form.html.erb index 69797e99a..8653aa1df 100644 --- a/app/views/searches/_form.html.erb +++ b/app/views/searches/_form.html.erb @@ -1,7 +1,7 @@ <%= form_with url: search_path, method: :get, class: "search__form" do |form| %>
No search results
/ <% end %>