Sha256: 05645069534477c9d6424dfcc3c7a577344639f9bf7fb3e0fe1cb0518861a560
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
module Spree module Api module V2 class ProductsController < Spree::Api::V2::BaseController skip_before_action :authenticate_user, only: [:index, :show] def index render_collection products.includes :variants, :master, :taxons, :option_types, master: :images end def show if params[:price_id] render_instance Spree::Price.find(params[:price_id]).product elsif params[:variant_id] render_instance Spree::Variant.find(params[:variant_id]).product elsif params[:image_id] render_instance Spree::Image.variants.find(params[:image_id]).viewable.product else render_instance products.find(params[:id]) end end private def products if params[:taxon_id].present? Spree::Taxon.find(params[:taxon_id]).products elsif params[:option_type_id] Spree::OptionType.find(params[:option_type_id]).products else Spree::Product end end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems