Class: CustomersController
Constant Summary
Localization::LOCALIZED_STRINGS
Instance Method Summary
collapse
in_place_edit_for, #initialize
#back_or_link_to, #detour?, #detour_to, #display_notice, #h, #image_button_to, #image_detour_to, #image_link_to, #image_link_to_remote, #insert, #record, #resolution_image, #t, #update_task, #with_detour
#l, load_localized_strings, #valid_language?
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/customers_controller.rb', line 23
def create
@customer = Customer.new(params[:customer])
if @customer.save
flash[:notice] = 'Customer was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
|
#destroy ⇒ Object
47
48
49
50
|
# File 'app/controllers/customers_controller.rb', line 47
def destroy
Customer.find(params[:id]).destroy
redirect_to :action => 'list'
end
|
#edit ⇒ Object
33
34
35
|
# File 'app/controllers/customers_controller.rb', line 33
def edit
@customer = Customer.find(params[:id])
end
|
#index ⇒ Object
2
3
4
5
|
# File 'app/controllers/customers_controller.rb', line 2
def index
list
render :action => 'list'
end
|
#list ⇒ Object
11
12
13
|
# File 'app/controllers/customers_controller.rb', line 11
def list
@customers = Customer.paginate :page => params[:page]
end
|
#new ⇒ Object
19
20
21
|
# File 'app/controllers/customers_controller.rb', line 19
def new
@customer = Customer.new
end
|
#show ⇒ Object
15
16
17
|
# File 'app/controllers/customers_controller.rb', line 15
def show
@customer = Customer.find(params[:id])
end
|
#update ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/customers_controller.rb', line 37
def update
@customer = Customer.find(params[:id])
if @customer.update_attributes(params[:customer])
flash[:notice] = 'Customer was successfully updated.'
redirect_to :action => 'show', :id => @customer
else
render :action => 'edit'
end
end
|