Class: KktShoppe::VariantsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- KktShoppe::VariantsController
- Defined in:
- app/controllers/kkt_shoppe/variants_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/kkt_shoppe/variants_controller.rb', line 17 def create @variant = @product.variants.build(safe_params) if @variant.save redirect_to [@product, :variants], :notice => t('kkt_shoppe.variants.create_notice') else render :action => "form" end end |
#destroy ⇒ Object
38 39 40 41 |
# File 'app/controllers/kkt_shoppe/variants_controller.rb', line 38 def destroy @variant.destroy redirect_to [@product, :variants], :notice => t('kkt_shoppe.variants.destroy_notice') end |
#edit ⇒ Object
26 27 28 |
# File 'app/controllers/kkt_shoppe/variants_controller.rb', line 26 def edit render :action => "form" end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/kkt_shoppe/variants_controller.rb', line 8 def index @variants = @product.variants.ordered end |
#new ⇒ Object
12 13 14 15 |
# File 'app/controllers/kkt_shoppe/variants_controller.rb', line 12 def new @variant = @product.variants.build render :action => "form" end |
#update ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/kkt_shoppe/variants_controller.rb', line 30 def update if @variant.update(safe_params) redirect_to edit_product_variant_path(@product, @variant), :notice => t('kkt_shoppe.variants.update_notice') else render :action => "form" end end |