Module: SolidusFriendlyPromotions::AdjustmentDecorator

Defined in:
app/decorators/models/solidus_friendly_promotions/adjustment_decorator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



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

def self.prepended(base)
  base.scope :friendly_promotion, -> { where(source_type: "SolidusFriendlyPromotions::Benefit") }
  base.scope :promotion, -> { where(source_type: ["SolidusFriendlyPromotions::Benefit", "Spree::PromotionAction"]) }
end

Instance Method Details

#friendly_promotion?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/decorators/models/solidus_friendly_promotions/adjustment_decorator.rb', line 10

def friendly_promotion?
  source_type == "SolidusFriendlyPromotions::Benefit"
end

#promotion?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/decorators/models/solidus_friendly_promotions/adjustment_decorator.rb', line 14

def promotion?
  super || source_type == "SolidusFriendlyPromotions::Benefit"
end