Sha256: a2cc4cddc8b0b51f3542063ed935707fc8b657500bed6ff4bd41c04929b51f0c
Contents?: true
Size: 1.24 KB
Versions: 20
Compression:
Stored size: 1.24 KB
Contents
module Comee module Core class ProductsController < ApplicationController include Common def index super do products = Product.leafs products.then(&paginate) end end def show super do product = Comee::Core::Product.with_attached_images.find(params[:id]) product end end def master_prices data = MasterPrice.where(product_id: price_params[:product_ids]) render json: {success: true, data: serialize(data)} end def client_prices data = ClientPrice.where(product_id: price_params[:product_ids]) render json: {success: true, data: serialize(data)} end def filter products = Product.ransack(params[:q]).result render json: {success: true, data: serialize(products)} end private def model_params params.required(:payload).permit(:code, :name, :description, :parent_id, :thumbnail_image, :preferred_units, :source_id, :weight, :weight_unit_id, :dimensions, :hs_code, :hs_description, images: []) end def price_params params.require(:payload).permit(product_ids: []) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems