Sha256: 332c3220eea8c88a9d751a7eb3f24a1de2227d9c8edccf4226887cc2b1619bf6
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Kms module Catalog class PropertiesController < ApplicationController def index @product = Product.find_by_id(params[:product_id]) @properties = @product.properties render json: @properties.to_json end def create @property = Property.new(property_params.merge(product_id: params[:product_id])) @property.save render json: @property.to_json end def update @property = Property.find(params[:id]) @property.update_attributes(property_params.merge(product_id: params[:product_id])) render json: @property.to_json end def destroy @property = Property.find(params[:id]) @property.destroy render json: @property.to_json end def tags @product = Product.find_by_id(params[:product_id]) render json: @product.properties.pluck(:tag).uniq.to_json end protected def property_params params.require(:property).permit! end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kms_catalog-0.5.0 | app/controllers/kms/catalog/properties_controller.rb |
kms_catalog-0.4.0 | app/controllers/kms/catalog/properties_controller.rb |