cart state for item in details page finnaly shows (arrggh worst kind of bugs)

This commit is contained in:
Senad Uka
2015-02-08 08:29:24 +01:00
parent 7770e59b81
commit 113b70e8fa
11 changed files with 139 additions and 37 deletions

View File

@@ -1,5 +1,6 @@
class Cart < ActiveRecord::Base
has_many :item_in_carts, -> { order "created_at" }
def self.find_or_create(anonymous_id, user_id)
cart = Cart.where(user_id: user_id).where(ordered: false).first
cart ||= Cart.where(anonymous_id_string: anonymous_id).where(ordered: false).first