8234cdcb244d053025bcc790324fc63b1b74352e
1 class StoreController
< ApplicationController
3 @products = Product
.find_products_for_sale
8 product
= Product
.find(params
[:id])
10 @current_item = @cart.add_product(product
)
11 respond_to
do |format
|
14 rescue ActiveRecord
::RecordNotFound
15 logger
.error("Attempt to access invalid product #{params[:id]}" )
16 redirect_to_index('Invalid product')
21 redirect_to_index('Your cart has been emptied')
27 session
[:cart] ||= Cart
.new
30 def redirect_to_index(msg
= nil)
31 flash
[:notice] = msg
if msg
32 redirect_to
:action => 'index'