1 class CustomerController < ApplicationController
4 render :action => 'list'
7 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
8 verify :method => :post, :only => [ :destroy, :create, :update ],
9 :redirect_to => { :action => :list }
12 @customer_pages, @customers = paginate :customers, :per_page => 10
16 @customer = Customer.find(params[:id])
20 @customer = Customer.new
24 @customer = Customer.new(params[:customer])
26 flash[:notice] = 'Customer was successfully created.'
27 redirect_to :action => 'list'
29 render :action => 'new'
34 @customer = Customer.find(params[:id])
38 @customer = Customer.find(params[:id])
39 if @customer.update_attributes(params[:customer])
40 flash[:notice] = 'Customer was successfully updated.'
41 redirect_to :action => 'show', :id => @customer
43 render :action => 'edit'
48 Customer.find(params[:id]).destroy
49 redirect_to :action => 'list'
53 render :action => 'searchbyname'
58 @customers = Customer.find(:all, :conditions => ["name like ?", query[0]+"%"] )