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



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

def options_for_promotion_rule_types(promotion)
  existing = promotion.rules.map { |rule| rule.class.name }
  rules = Spree::Config.promotions.rules.reject { |rule| existing.include? rule.name }
  options = rules.map { |rule| [rule.model_name.human, rule.name] }
  options_for_select(options)
end