Module: Spree::PromotionRulesHelper

Defined in:
app/helpers/spree/promotion_rules_helper.rb

Instance Method Summary collapse

Instance Method Details

#options_for_promotion_rule_types(promotion) ⇒ Object


4
5
6
7
8
9
# File 'app/helpers/spree/promotion_rules_helper.rb', line 4

def options_for_promotion_rule_types(promotion)
  existing = promotion.rules.map { |rule| rule.class.name }
  rule_names = Rails.application.config.spree.promotions.rules.map(&:name).reject{ |r| existing.include? r }
  options = rule_names.map { |name| [ Spree.t("promotion_rule_types.#{name.demodulize.underscore}.name"), name] }
  options_for_select(options)
end