Commit a163d341 by Nguyen Quoc Kien

Fixed find_product #2

parent 6e7cea70
...@@ -45,6 +45,8 @@ class ApplicationController < ActionController::Base ...@@ -45,6 +45,8 @@ class ApplicationController < ActionController::Base
def find_product def find_product
if params[:id].to_i > (Product.count + 1) if params[:id].to_i > (Product.count + 1)
redirect_to error_path redirect_to error_path
elsif is_number?(params[:id]) == false
redirect_to error_path
else else
@product = Product.find(params[:id]) @product = Product.find(params[:id])
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment