Sha256: 401a56a1dd33539ed110e89873c0fd874d029253f78c8382806b464777a95556
Contents?: true
Size: 905 Bytes
Versions: 3
Compression:
Stored size: 905 Bytes
Contents
class TbCommerce::Api::CartItemsController < TbCommerce::Api::BaseController before_action :load_cart before_action :load_cart_item, :only => [:update, :destroy] def create @cart_item = @cart.cart_items.create(cart_item_params) respond_with @cart_item end def update @cart_item.update_attributes(cart_item_params) respond_with @cart_item end def destroy @cart_item.destroy() respond_with @cart_item end private def load_cart @cart = tb_commerce_current_cart end def load_cart_item @cart_item = @cart.cart_items.find_by!(:id => params[:id]) end def cart_item_params params.require(:tb_commerce_cart_item).permit(:tb_commerce_product_sku_id, :quantity).tap do |white_listed| white_listed[:configuration] = params[:tb_commerce_cart_item][:configuration] if params[:tb_commerce_cart_item][:configuration].present? end end end
Version data entries
3 entries across 3 versions & 1 rubygems