Class: Spree::Wishlist
- Inherits:
-
Object
- Object
- Spree::Wishlist
- Includes:
- SingleStoreResource, Spree::Webhooks::HasWebhooks
- Defined in:
- app/models/spree/wishlist.rb
Class Method Summary collapse
Instance Method Summary collapse
- #include?(variant_id) ⇒ Boolean
- #to_param ⇒ Object
-
#variant_ids ⇒ Array<Integer>
returns the variant ids in the wishlist.
-
#wished_items_count ⇒ Integer
returns the number of wished items in the wishlist.
Class Method Details
.get_by_param(param) ⇒ Object
46 47 48 |
# File 'app/models/spree/wishlist.rb', line 46 def self.get_by_param(param) find_by(token: param) end |
Instance Method Details
#include?(variant_id) ⇒ Boolean
24 25 26 |
# File 'app/models/spree/wishlist.rb', line 24 def include?(variant_id) wished_items.exists?(variant_id: variant_id) end |
#to_param ⇒ Object
28 29 30 |
# File 'app/models/spree/wishlist.rb', line 28 def to_param token end |
#variant_ids ⇒ Array<Integer>
returns the variant ids in the wishlist
42 43 44 |
# File 'app/models/spree/wishlist.rb', line 42 def variant_ids @variant_ids ||= wished_items.pluck(:variant_id) end |
#wished_items_count ⇒ Integer
returns the number of wished items in the wishlist
35 36 37 |
# File 'app/models/spree/wishlist.rb', line 35 def wished_items_count @wished_items_count ||= variant_ids.count end |