Sha256: 1defc8662bddf65822788ac33dfdcf7d0281da32fc6908ed505273f3accd9de9

Contents?: true

Size: 631 Bytes

Versions: 131

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true

module Spree
  module Admin
    class PromotionCodeBatchesController < ResourceController
      belongs_to 'spree/promotion'

      create.after :build_promotion_code_batch

      def download
        require "csv"

        @promotion_code_batch = Spree::PromotionCodeBatch.find(
          params[:promotion_code_batch_id]
        )

        send_data(
          render_to_string,
          filename: "promotion-code-batch-list-#{@promotion_code_batch.id}.csv"
        )
      end

      private

      def build_promotion_code_batch
        @promotion_code_batch.process
      end
    end
  end
end

Version data entries

131 entries across 131 versions & 3 rubygems

Version Path
solidus_legacy_promotions-4.4.1 lib/controllers/backend/spree/admin/promotion_code_batches_controller.rb
solidus_legacy_promotions-4.4.0 lib/controllers/backend/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.3.4 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.2.4 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.1.5 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.3.3 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.3.2 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.1.4 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.3.1 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.3.0 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.2.3 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.1.3 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.0.4 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-3.4.6 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.0.3 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.1.2 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.2.2 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-3.4.5 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.2.1 app/controllers/spree/admin/promotion_code_batches_controller.rb
solidus_backend-4.2.0 app/controllers/spree/admin/promotion_code_batches_controller.rb