Module: Workarea::FeaturedProducts
- Extended by:
- ActiveSupport::Concern
- Included in:
- Catalog::Category, Search::Customization
- Defined in:
- app/models/workarea/featured_products.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_product(id) ⇒ Object
- #featured_product?(id) ⇒ Boolean
- #featured_products? ⇒ Boolean
- #remove_product(id_to_remove) ⇒ Object
Class Method Details
Instance Method Details
#add_product(id) ⇒ Object
28 29 30 31 |
# File 'app/models/workarea/featured_products.rb', line 28 def add_product(id) product_ids.prepend(id) save end |
#featured_product?(id) ⇒ Boolean
24 25 26 |
# File 'app/models/workarea/featured_products.rb', line 24 def featured_product?(id) id.to_s.in?(product_ids) end |
#featured_products? ⇒ Boolean
20 21 22 |
# File 'app/models/workarea/featured_products.rb', line 20 def featured_products? product_ids.present? end |
#remove_product(id_to_remove) ⇒ Object
33 34 35 36 |
# File 'app/models/workarea/featured_products.rb', line 33 def remove_product(id_to_remove) product_ids.reject! { |id| id == id_to_remove } save end |