Class: SolidusFriendlyPromotions::PromotionAdvertiser

Inherits:
Object
  • Object
show all
Defined in:
app/models/solidus_friendly_promotions/promotion_advertiser.rb

Class Method Summary collapse

Class Method Details

.for_product(product) ⇒ Object



5
6
7
8
# File 'app/models/solidus_friendly_promotions/promotion_advertiser.rb', line 5

def self.for_product(product)
  promotion_ids = ConditionProduct.joins(condition: :benefit).where(product: product).select(:promotion_id).distinct
  SolidusFriendlyPromotions::Promotion.advertised.where(id: promotion_ids).reject(&:inactive?)
end