Sha256: e98d9d29d101516c4e2c471ecc98295335a1f675884c3a516a1e4a64b3f085ea

Contents?: true

Size: 464 Bytes

Versions: 5

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

module CreateSubscription
  extend ActiveSupport::Concern
  include SolidusSubscriptions::SubscriptionLineItemBuilder

  included do
    after_action :handle_subscription_line_items, only: :create, if: ->{ params[:subscription_line_item] }
  end

  private

  def handle_subscription_line_items
    line_item = @current_order.line_items.find_by(variant_id: params[:variant_id])
    create_subscription_line_item(line_item)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 lib/generators/solidus_subscriptions/install/templates/app/controllers/concerns/create_subscription.rb
solidus_subscriptions-2.0.1 lib/generators/solidus_subscriptions/install/templates/app/controllers/concerns/create_subscription.rb
solidus_subscriptions-2.0.0 lib/generators/solidus_subscriptions/install/templates/app/controllers/concerns/create_subscription.rb
solidus_subscriptions-1.1.0 lib/generators/solidus_subscriptions/install/templates/app/controllers/concerns/create_subscription.rb
solidus_subscriptions-1.0.1 lib/generators/solidus_subscriptions/install/templates/app/controllers/concerns/create_subscription.rb