small medium large xlarge

30 Apr 2013, 20:35
Allan Berry (8 posts)

I started again with code from depot_f and Chapter 9.2.

I notice there are two set_cart functions * app/controllers/concerns/current_cart.rb#set_cart * app/controllers/carts_controller#set_cart

(the first is implemented in C9.2, the second exists already in depot_f)

both implement @cart = Cart.find( ... )

Why is this? Can you explain the difference between the two?

01 May 2013, 12:28
Sam Ruby (634 posts)

The first sets the value of @cart from the session, and is used by the LineItemsController, OrderController, and StoreController.

The latter sets the value of @cart from the request parameters, and is used by CartController.

I’ll investigate making the CartController more like the rest.

You must be logged in to comment