Fix LIKE clauses in searches to match anywhere in the field
[cs356-p2-videostore.git] / app / controllers / game_controller.rb
index c75ce07..626d51a 100644 (file)
@@ -56,7 +56,7 @@ class GameController < ApplicationController
   def search
     if request.post?
       @query = params[:q]
-      @games = Game.find(:all, :conditions => ["title like ?", @query[0]+"%"])
+      @games = Game.find(:all, :conditions => ["title like ?", "%#{@query[0]}%"])
       render :action => 'searchresults'
     else
       render :action => 'search'