1 class StoreController
< ApplicationController
3 @products = Product
.find_products_for_sale
7 product
= Product
.find(params
[:id])
9 @cart.add_product(product
)
10 rescue ActiveRecord
::RecordNotFound
11 logger
.error("Attempt to access invalid product #{params[:id]}" )
12 redirect_to_index('Invalid product')
17 redirect_to_index('Your cart has been emptied')
23 session
[:cart] ||= Cart
.new
26 def redirect_to_index(msg
)
28 redirect_to
:action => 'index'