summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-09-30 14:48:00 +0200
committerGitHub <noreply@github.com>2020-09-30 14:48:00 +0200
commitf6181cb98d21aa2e80d9344e328cd82be40c9682 (patch)
tree898665399d8481609d5047c02e86bec9dc0ad69f /lib
parente30a0fb2dea090f4e30b07c9fcfd5c10d8c86164 (diff)
parent67abf8e6bda0b29eaa891c4f0e09c7ea811ce668 (diff)
Merge pull request #149 from solidusio-contrib/aldesantis/store-subscribable-type
Implement a `LineItem#subscribable` association
Diffstat (limited to 'lib')
-rw-r--r--lib/generators/solidus_subscriptions/install/templates/initializer.rb3
-rw-r--r--lib/solidus_subscriptions/configuration.rb7
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/generators/solidus_subscriptions/install/templates/initializer.rb b/lib/generators/solidus_subscriptions/install/templates/initializer.rb
index 3afcb90..fb4fa46 100644
--- a/lib/generators/solidus_subscriptions/install/templates/initializer.rb
+++ b/lib/generators/solidus_subscriptions/install/templates/initializer.rb
@@ -5,6 +5,9 @@ SolidusSubscriptions.configure do |config|
# you subclass from the the dispatcher you are replacing, and call
# `super` from within the #dispatch method (if you override it).
+ # The ActiveRecord model users can subscribe to.
+ # config.subscribable_class = 'Spree::Variant'
+
# This handler is called when a subscription order is successfully placed.
# config.success_dispatcher_class = 'SolidusSubscriptions::SuccessDispatcher'
diff --git a/lib/solidus_subscriptions/configuration.rb b/lib/solidus_subscriptions/configuration.rb
index 3ab5f82..d5dc80f 100644
--- a/lib/solidus_subscriptions/configuration.rb
+++ b/lib/solidus_subscriptions/configuration.rb
@@ -8,7 +8,7 @@ module SolidusSubscriptions
:success_dispatcher_class, :failure_dispatcher_class, :payment_failed_dispatcher_class,
:out_of_stock_dispatcher, :maximum_successive_skips, :reprocessing_interval,
:minimum_cancellation_notice, :processing_queue, :subscription_line_item_attributes,
- :subscription_attributes,
+ :subscription_attributes, :subscribable_class,
)
def success_dispatcher_class
@@ -68,5 +68,10 @@ module SolidusSubscriptions
},
]
end
+
+ def subscribable_class
+ @subscribable_class ||= 'Spree::Variant'
+ @subscribable_class.constantize
+ end
end
end