small medium large xlarge

Generic-user-small
01 May 2009, 15:29
Kedar Mhaswade (21 posts)

Reached page 125. Things are going fine. Thank you Sam, Dave and David. The Ajaxifying of cart worked perfectly.

There is one minor comment and I believe it needs a change in the store controller. This is how the empty_cart method (in depot_l/app/controllers/store/store_controller.rb) looks like:

  def empty_cart
    session[:cart] = nil
    redirect_to_index("Your cart is currently empty")
  end

What happens because of this redirect and now that cart addition is Ajaxified is that even after adding an item to cart, the flash from a previous emptying of cart remains at the top of index page! This is because add_to_cart no more fetches the index page, but just updates side bar.

I believe the code should be changed thus:

  def empty_cart
    session[:cart] = nil
    redirect_to_index
  end

Thank you, Kedar

Generic-user-small
02 May 2009, 03:26
Kedar Mhaswade (21 posts)

OK, my bad. This is covered at page 131.

You must be logged in to comment