Changeset 1089
- Timestamp:
- 09/30/08 23:00:37 (18 months ago)
- Location:
- rails_book/depot/app
- Files:
-
- 2 modified
-
controllers/store_controller.rb (modified) (1 diff)
-
views/layouts/store.html.erb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rails_book/depot/app/controllers/store_controller.rb
r1087 r1089 5 5 6 6 def add_to_cart 7 @cart = find_cart 8 product = Product.find(params[:id]) 9 @cart.add_product(product) 7 begin 8 product = Product.find(params[:id]) 9 rescue ActiveRecord::RecordNotFound 10 logger.error("Attempt to access invalid product #{params[:id]}") 11 flash[:notice] = "Invalid product" 12 redirect_to :action => :index 13 else 14 @cart = find_cart 15 @cart.add_product(product) 16 end 10 17 end 11 18 -
rails_book/depot/app/views/layouts/store.html.erb
r1083 r1089 17 17 </div> 18 18 <div id="main"> 19 <% if flash[:notice] -%> 20 <div id="notice"><%= flash[:notice] %></div> 21 <% end -%> 19 22 <%= yield :layout %> 20 23 </div>
