Class: NimbleshopSimply::CartsController

Inherits:
SimplyController
  • Object
show all
Defined in:
app/controllers/nimbleshop_simply/carts_controller.rb

Instance Method Summary collapse

Instance Method Details

#addObject



11
12
13
14
15
16
# File 'app/controllers/nimbleshop_simply/carts_controller.rb', line 11

def add
  product = Product.find_by_permalink!(params[:permalink])
  session[:order_id] = Order.create!.id unless current_order
  current_order.add(product)
  redirect_to cart_url
end

#checkingoutObject



18
19
20
# File 'app/controllers/nimbleshop_simply/carts_controller.rb', line 18

def checkingout
  redirect_to new_checkout_shipping_address_path
end

#showObject



6
7
8
9
# File 'app/controllers/nimbleshop_simply/carts_controller.rb', line 6

def show
  @line_items = current_order.blank? ? [] : current_order.line_items(include: :product).order('id')
  respond_with @line_items
end

#updateObject



22
23
24
25
# File 'app/controllers/nimbleshop_simply/carts_controller.rb', line 22

def update
  current_order.update_quantity(params[:updates])
  redirect_to cart_url
end