Module: MuckCommerce::Models::MuckCart
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/muck-commerce/models/cart.rb
Instance Method Summary collapse
- #before_create ⇒ Object
- #empty? ⇒ Boolean
- #generate_token ⇒ Object
-
#items ⇒ Object
Override this method in your cart.
Instance Method Details
#before_create ⇒ Object
23 24 25 |
# File 'lib/muck-commerce/models/cart.rb', line 23 def before_create generate_token end |
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/muck-commerce/models/cart.rb', line 19 def empty? self.items.empty? end |
#generate_token ⇒ Object
27 28 29 |
# File 'lib/muck-commerce/models/cart.rb', line 27 def generate_token self.token = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{self.id}--") end |
#items ⇒ Object
Override this method in your cart
32 33 34 |
# File 'lib/muck-commerce/models/cart.rb', line 32 def items [] end |