Module: Workarea::FeaturedProducts
- Extended by:
- ActiveSupport::Concern
- Included in:
- Catalog::Category, Search::Customization
- Defined in:
- app/models/workarea/featured_products.rb
Instance Method Summary collapse
- #add_product(id) ⇒ Object
- #featured_product?(id) ⇒ Boolean
- #featured_products? ⇒ Boolean
- #remove_product(id_to_remove) ⇒ Object
Instance Method Details
#add_product(id) ⇒ Object
20 21 22 23 |
# File 'app/models/workarea/featured_products.rb', line 20 def add_product(id) product_ids.prepend(id) save end |
#featured_product?(id) ⇒ Boolean
16 17 18 |
# File 'app/models/workarea/featured_products.rb', line 16 def featured_product?(id) id.to_s.in?(product_ids) end |
#featured_products? ⇒ Boolean
12 13 14 |
# File 'app/models/workarea/featured_products.rb', line 12 def featured_products? product_ids.present? end |
#remove_product(id_to_remove) ⇒ Object
25 26 27 28 |
# File 'app/models/workarea/featured_products.rb', line 25 def remove_product(id_to_remove) product_ids.reject! { |id| id == id_to_remove } save end |