Class: Admin::Shop::Products::VariantTemplatesController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/admin/shop/products/variant_templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/admin/shop/products/variant_templates_controller.rb', line 5

def update
  error = 'Could not attach all Variants to Product.'
  
  @shop_product = ShopProduct.find(params[:product_id])
  
  if @shop_product.apply_variant_template(@shop_variant)
    respond_to do |format|
      format.html {
        redirect_to [ :edit_admin, @shop_product ]
      }
    end
  else
    respond_to do |format|
      format.html { 
        flash[:error] = error
        redirect_to [ :edit_admin, @shop_product ]
      }
    end
  end
  
end