diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 196811e..5de72d3 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -8,6 +8,7 @@ def index end def search + @search_term = params[:q] st = "%#{params[:q]}%" @items = Item.where("title like ?", st) end diff --git a/app/views/items/search.html.erb b/app/views/items/search.html.erb index 295f9b1..37fddd2 100644 --- a/app/views/items/search.html.erb +++ b/app/views/items/search.html.erb @@ -1,7 +1,13 @@

<%= notice %>

-

Games

+

You search our product catalog for: <%= @search_term %>

+ +<% if @items.length == 0 %> +
+

No products were found to match your search

+<% end %> + <% @items.each do |item| %>