Class: Kms::Catalog::OptionValuesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Kms::Catalog::OptionValuesController
- Defined in:
- app/controllers/kms/catalog/option_values_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 |
# File 'app/controllers/kms/catalog/option_values_controller.rb', line 11 def create @product = Product.find_by_id(params[:product_id]) @variant = @product.variants.find_by_id(params[:variant_id]) @option_value = @variant.option_values.create(option_values_params) render json: @option_value.to_json end |
#destroy ⇒ Object
18 19 20 21 22 |
# File 'app/controllers/kms/catalog/option_values_controller.rb', line 18 def destroy @option_value = OptionValue.find_by_id(params[:id]) @option_value.destroy if @option_value render json: @option_value.to_json end |
#index ⇒ Object
4 5 6 7 8 9 |
# File 'app/controllers/kms/catalog/option_values_controller.rb', line 4 def index @product = Product.find_by_id(params[:product_id]) @variant = @product.variants.find_by_id(params[:variant_id]) @option_values = @variant.option_values render json: @option_values.to_json(methods: [:tag, :name]) end |