summaryrefslogtreecommitdiff
path: root/app/controllers/manufacturers_controller.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
commitb80bd744ad873f6fc43018bc4bfb90677de167bd (patch)
tree072c4b0e33d442528555b82c415f5e7a1712b2b0 /app/controllers/manufacturers_controller.rb
parent3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff)
Start of GS5.
Diffstat (limited to 'app/controllers/manufacturers_controller.rb')
-rw-r--r--app/controllers/manufacturers_controller.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/controllers/manufacturers_controller.rb b/app/controllers/manufacturers_controller.rb
new file mode 100644
index 0000000..1bcf9de
--- /dev/null
+++ b/app/controllers/manufacturers_controller.rb
@@ -0,0 +1,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