Add required authorization to all pages
[cs356-p2-videostore.git] / app / controllers / customer_controller.rb
index 6f7c8ee..1e560c0 100644 (file)
@@ -1,4 +1,8 @@
 class CustomerController < ApplicationController
+
+  # Make sure that the user has logged in before they can take any action
+  before_filter :authorize
+
   def index
     list
     render :action => 'list'
@@ -48,4 +52,13 @@ class CustomerController < ApplicationController
     Customer.find(params[:id]).destroy
     redirect_to :action => 'list'
   end
+
+  def searchbyname
+    render :action => 'searchbyname'
+  end
+
+  def searchresults
+    query = params[:q]
+    @customers = Customer.find(:all, :conditions => ["name like ?", query[0]+"%"] )
+  end
 end