From 41885d548ad9870fd2272543c09241f81cc92d2b Mon Sep 17 00:00:00 2001 From: Brendan Deere Date: Wed, 28 Sep 2016 13:56:21 -0700 Subject: Register Subscription promotion rule with solidus Add the custom promotion rule to the list of solidus promotion rules. add some translations and an empty template so that the admin can render the promotion rule properly --- lib/solidus_subscriptions/engine.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/solidus_subscriptions/engine.rb') diff --git a/lib/solidus_subscriptions/engine.rb b/lib/solidus_subscriptions/engine.rb index 50b1dc1..78f0d47 100644 --- a/lib/solidus_subscriptions/engine.rb +++ b/lib/solidus_subscriptions/engine.rb @@ -15,6 +15,10 @@ module SolidusSubscriptions require 'solidus_subscriptions/config' end + initializer 'register_subscription_promotion_rule', after: 'spree.promo.register.promotion.rules' do |app| + app.config.spree.promotions.rules << 'SolidusSubscriptions::SubscriptionPromotionRule' + end + def self.activate Dir.glob(File.join(File.dirname(__FILE__), '../../app/decorators/**/*.rb')) do |c| Rails.configuration.cache_classes ? require(c) : load(c) -- cgit v1.2.3