diff options
Diffstat (limited to 'app/services/solidus_subscriptions/line_item_builder.rb')
-rw-r--r-- | app/services/solidus_subscriptions/line_item_builder.rb | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/app/services/solidus_subscriptions/line_item_builder.rb b/app/services/solidus_subscriptions/line_item_builder.rb index 1d3ea9b..d258787 100644 --- a/app/services/solidus_subscriptions/line_item_builder.rb +++ b/app/services/solidus_subscriptions/line_item_builder.rb @@ -22,7 +22,7 @@ module SolidusSubscriptions # @return [Array<Spree::LineItem>] def spree_line_items line_items = subscription_line_items.map do |subscription_line_item| - variant = subscribables.fetch(subscription_line_item.subscribable_id) + variant = subscription_line_item.subscribable raise UnsubscribableError, variant unless variant.subscribable? next unless variant.can_supply?(subscription_line_item.quantity) @@ -33,14 +33,5 @@ module SolidusSubscriptions # Either all line items for an installment are fulfilled or none are line_items.all? ? line_items : [] end - - private - - def subscribables - return @subscribables if @subscribables - - ids = subscription_line_items.map(&:subscribable_id) - @subscribables ||= ::Spree::Variant.find(ids).index_by(&:id) - end end end |