Class: Kms::Public::CartController

Inherits:
ActionController::Base
  • Object
show all
Includes:
CurrentCart
Defined in:
app/controllers/kms/public/cart_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



16
17
18
# File 'app/controllers/kms/public/cart_controller.rb', line 16

def destroy
  current_cart.line_items.clear
end

#updateObject



7
8
9
10
11
12
13
14
# File 'app/controllers/kms/public/cart_controller.rb', line 7

def update
  cart_populator = Kms::CartPopulator.new(current_cart, params)
  if cart_populator.populate
    render json: current_cart, root: false
  else
    render json: {errors: cart_populator.errors}.to_json, status: :unprocessable_entity
  end
end