Fix LIKE clauses in searches to match anywhere in the field
[cs356-p2-videostore.git] / app / controllers / customer_controller.rb
index 296f64f..f6ec048 100644 (file)
@@ -56,7 +56,7 @@ class CustomerController < ApplicationController
   def search
     if request.post?
       @query = params[:q]
-      @customers = Customer.find(:all, :conditions => ["name like ?", @query[0]+"%"])
+      @customers = Customer.find(:all, :conditions => ["name like ?", "%#{@query[0]}%"])
       render :action => 'searchresults'
     else
       render :action => 'search'