projects
/
cs356-p2-videostore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Rental Policies and Limits
[cs356-p2-videostore.git]
/
app
/
controllers
/
customer_controller.rb
diff --git
a/app/controllers/customer_controller.rb
b/app/controllers/customer_controller.rb
index
6f7c8ee
..
296f64f
100644
(file)
--- a/
app/controllers/customer_controller.rb
+++ b/
app/controllers/customer_controller.rb
@@
-1,7
+1,11
@@
class CustomerController < ApplicationController
class CustomerController < ApplicationController
+ layout "admin"
+
+ # Make sure that the user has logged in before they can take any action
+ before_filter :authorize
+
def index
def index
- list
- render :action => 'list'
+ render :action => 'index'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
@@
-48,4
+52,14
@@
class CustomerController < ApplicationController
Customer.find(params[:id]).destroy
redirect_to :action => 'list'
end
Customer.find(params[:id]).destroy
redirect_to :action => 'list'
end
+
+ def search
+ if request.post?
+ @query = params[:q]
+ @customers = Customer.find(:all, :conditions => ["name like ?", @query[0]+"%"])
+ render :action => 'searchresults'
+ else
+ render :action => 'search'
+ end
+ end
end
end