Class: Admin::ProductTypesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::ProductTypesController
- Defined in:
- app/controllers/admin/product_types_controller.rb
Overview
This Controller Manage Products and his association with ProductDetail
Instance Method Summary collapse
-
#create ⇒ Object
Create a ProductType ==== Params * product_type = Hash of ProductType’s attributes.
-
#destroy ⇒ Object
Destroy a ProductType ==== Params * id = ProductType’s id.
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
-
#update ⇒ Object
Update a ProductType ==== Params * id = ProductType’s id.
Instance Method Details
#create ⇒ Object
Create a ProductType
Params
-
product_type = Hash of ProductType’s attributes
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/admin/product_types_controller.rb', line 27 def create if @product_type.save flash[:notice] = I18n.t('product_type.create.success').capitalize redirect_to([forgeos_commerce, :edit, :admin, @product_type]) else flash[:error] = I18n.t('product_type.create.failed').capitalize render :action => :new end end |
#destroy ⇒ Object
Destroy a ProductType
Params
-
id = ProductType’s id
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/admin/product_types_controller.rb', line 55 def destroy if @product_type.destroy flash[:notice] = I18n.t('product.destroy.success').capitalize else flash[:error] = I18n.t('product.destroy.failed').capitalize end respond_to do |wants| wants.html do redirect_to([forgeos_commerce, :admin, :product_types]) end wants.js end end |
#edit ⇒ Object
37 38 |
# File 'app/controllers/admin/product_types_controller.rb', line 37 def edit end |
#index ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/admin/product_types_controller.rb', line 8 def index respond_to do |format| format.html format.json do sort render :layout => false end end end |
#new ⇒ Object
21 22 |
# File 'app/controllers/admin/product_types_controller.rb', line 21 def new end |
#show ⇒ Object
18 19 |
# File 'app/controllers/admin/product_types_controller.rb', line 18 def show end |
#update ⇒ Object
Update a ProductType
Params
-
id = ProductType’s id
43 44 45 46 47 48 49 50 |
# File 'app/controllers/admin/product_types_controller.rb', line 43 def update if @product_type.update_attributes(params[:product_type]) flash[:notice] = I18n.t('product.update.success').capitalize else flash[:error] = I18n.t('product.update.failed').capitalize end render :action => 'edit' end |