Class: Spree::Wishlist

Inherits:
Object
  • Object
show all
Includes:
SingleStoreResource
Defined in:
app/models/spree/wishlist.rb

Instance Method Summary collapse

Instance Method Details

#include?(variant_id) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/spree/wishlist.rb', line 26

def include?(variant_id)
  wished_items.exists?(variant_id: variant_id)
end

#variant_idsArray<Integer>

returns the variant ids in the wishlist

Returns:

  • (Array<Integer>)


40
41
42
# File 'app/models/spree/wishlist.rb', line 40

def variant_ids
  @variant_ids ||= wished_items.pluck(:variant_id)
end

#wished_items_countInteger

returns the number of wished items in the wishlist

Returns:

  • (Integer)


33
34
35
# File 'app/models/spree/wishlist.rb', line 33

def wished_items_count
  @wished_items_count ||= variant_ids.count
end