Class: Workarea::Admin::CatalogProductSwatchesController
- Inherits:
-
Admin::ApplicationController
- Object
- Admin::ApplicationController
- Workarea::Admin::CatalogProductSwatchesController
- Defined in:
- app/controllers/workarea/admin/catalog_product_swatches_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/workarea/admin/catalog_product_swatches_controller.rb', line 10 def create @swatch = @product.swatches.build(params[:swatch]) if @swatch.save flash[:success] = t('workarea.admin.catalog_product_swatches.flash_messages.saved') redirect_to catalog_product_swatches_path(@product) else render :index, status: :unprocessable_entity end end |
#destroy ⇒ Object
33 34 35 36 37 |
# File 'app/controllers/workarea/admin/catalog_product_swatches_controller.rb', line 33 def destroy @product.swatches.find(params[:id]).destroy flash[:success] = t('workarea.admin.catalog_product_swatches.flash_messages.removed') redirect_to catalog_product_swatches_path(@product) end |
#index ⇒ Object
7 8 |
# File 'app/controllers/workarea/admin/catalog_product_swatches_controller.rb', line 7 def index end |
#update ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/workarea/admin/catalog_product_swatches_controller.rb', line 21 def update @swatch = @product.swatches.find(params[:id]) if @swatch.update_attributes(params[:swatch]) flash[:success] = t('workarea.admin.catalog_product_swatches.flash_messages.saved') redirect_to catalog_product_swatches_path(@product) else flash[:error] = t('workarea.admin.catalog_product_swatches.flash_messages.error') render :index end end |