summaryrefslogtreecommitdiff
path: root/lib/solidus_subscriptions/engine.rb
diff options
context:
space:
mode:
authorBrendan Deere <brendan.g.deere@gmail.com>2017-05-22 09:02:31 -0700
committerBrendan Deere <brendan.g.deere@gmail.com>2017-05-23 05:43:49 -0700
commitc61f4d6cf118d1724da3399617edb708b2f8c00b (patch)
tree349d507239ab04a49142336aa91bc9213591eed3 /lib/solidus_subscriptions/engine.rb
parent915ea6287e362f288164843ad76da6b1a0d44d4d (diff)
Only load permitted attributes once
Previous Behaviour: The to_prepare block was reloading the permitted attributes module. This resulted in the subscription parameters being appended to the spree premitted attributes multiple times. New behaviour: Do not auto load the lib directory Only load the permitted attributes once during the initalization process
Diffstat (limited to 'lib/solidus_subscriptions/engine.rb')
-rw-r--r--lib/solidus_subscriptions/engine.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/solidus_subscriptions/engine.rb b/lib/solidus_subscriptions/engine.rb
index baf4d9f..37c34e5 100644
--- a/lib/solidus_subscriptions/engine.rb
+++ b/lib/solidus_subscriptions/engine.rb
@@ -1,6 +1,9 @@
module SolidusSubscriptions
class Engine < Rails::Engine
require 'spree/core'
+ require 'solidus_subscriptions/permitted_attributes'
+ require 'solidus_subscriptions/config'
+ require 'solidus_subscriptions/processor'
isolate_namespace SolidusSubscriptions
engine_name 'solidus_subscriptions'
@@ -11,10 +14,12 @@ module SolidusSubscriptions
end
config.autoload_paths << config.root.join('app', 'jobs')
- config.autoload_paths << config.root.join('lib')
- initializer 'solidus_subscriptions.configs', before: "spree.register.payment_methods" do
- require 'solidus_subscriptions/config'
+ initializer 'configure spree subcription permitted attributes', after: 'require subscription lib helpers' do
+ PermittedAttributes.update_spree_permiteed_attributes
+ end
+
+ initializer 'solidus_subscriptions.configs', before: "require subscription lib helpers" do
end
initializer 'register_subscription_promotion_rule', after: 'spree.promo.register.promotion.rules' do |app|
@@ -39,7 +44,6 @@ module SolidusSubscriptions
end
Spree::Ability.register_ability(SolidusSubscriptions::Ability)
- PermittedAttributes.update_spree_permiteed_attributes
end
config.to_prepare(&method(:activate).to_proc)