blob: 1bcf9de4e165066c958345b302f5e3b32be80f7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
class ManufacturersController < ApplicationController
load_and_authorize_resource :manufacturer
before_filter :spread_breadcrumbs
def index
end
def show
end
def new
end
def create
@manufacturer = Manufacturer.new(params[:manufacturer])
if @manufacturer.save
redirect_to @manufacturer, :notice => t('manufacturers.controller.successfuly_created')
else
render :new
end
end
def edit
end
def update
if @manufacturer.update_attributes(params[:manufacturer])
redirect_to @manufacturer, :notice => t('manufacturers.controller.successfuly_updated')
else
render :edit
end
end
def destroy
@manufacturer.destroy
redirect_to manufacturers_url, :notice => t('manufacturers.controller.successfuly_destroyed')
end
private
def spread_breadcrumbs
add_breadcrumb t("manufacturers.index.page_title"), manufacturers_path
if @manufacturer && !@manufacturer.new_record?
add_breadcrumb @manufacturer, manufacturer_path(@manufacturer)
end
end
end
|