Commit 79806f7d by vulehuan

fix error occured when using mongodb

parent 15fbdf8d
......@@ -7,7 +7,7 @@ class CardsController < ApplicationController
@card_infos = session[:SHOPPING_CARD_SESSION_NAME]
end
unless params[:product_id].blank?
if Product.exists?(params[:product_id])
if Product.where(id: params[:product_id]).exists?
# if remove a product from card
if !params[:card_action].blank? && params[:card_action] == 'remove'
# Nothing to delete
......@@ -183,7 +183,7 @@ class CardsController < ApplicationController
end
def thankyou
if params[:card_id].blank? || !MyCard.exists?(params[:card_id])
if params[:card_id].blank? || !MyCard.where(id: params[:card_id]).exists?
flash[:error] = "Invalid card request"
redirect_to root_path and return
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