Class: IshManager::CoTailorsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::CoTailorsController
- Defined in:
- app/controllers/ish_manager/co_tailors_controller.rb
Instance Method Summary collapse
Instance Method Details
#create_product ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/ish_manager/co_tailors_controller.rb', line 9 def create_product :create, ::CoTailors::Product @product = ::CoTailors::Product.new params[:co_tailors_product].permit! if @product.save flash[:notice] = 'Created product' else flash[:alert] = 'Cannot create product: ', @product.errors..to_s end redirect_to :action => 'home' end |
#home ⇒ Object
4 5 6 7 |
# File 'app/controllers/ish_manager/co_tailors_controller.rb', line 4 def home :home, ::CoTailors @products = ::CoTailors::Product.all end |
#update_product ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/ish_manager/co_tailors_controller.rb', line 20 def update_product @product = ::CoTailors::Product.find params[:id] :update, @product if @product.update_attributes params[:co_tailors_product].permit! flash[:notice] = 'updated product' else flash[:alert] = 'Cannot update product: ', @product.errors..to_s end redirect_to :action => 'home' end |