Skip to content

Commit

Permalink
例外処理
Browse files Browse the repository at this point in the history
  • Loading branch information
kyanny committed Jan 20, 2010
1 parent 644c0b3 commit 52d3aca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions depot/app/controllers/store_controller.rb
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
class StoreController < ApplicationController
def index
@products = Product.find_products_for_sale
Expand All @@ -7,6 +8,10 @@ def add_to_cart
product = Product.find(params[:id])
@cart = find_cart
@cart.add_product(product)
rescue
logger.error("無効な商品#{params[:id]}にアクセスしようとしました")
flash[:notice] = "無効な商品です"
redirect_to :action => "index"
end

private
Expand Down

0 comments on commit 52d3aca

Please sign in to comment.