Class: SolidusFriendlyPromotions::Admin::PromotionCodeBatchesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/solidus_friendly_promotions/admin/promotion_code_batches_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#collection_url, #edit_object_url, #new_object_url, #object_url, #parent, #parent_model_name, #routes_proxy

Instance Method Details

#downloadObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/solidus_friendly_promotions/admin/promotion_code_batches_controller.rb', line 10

def download
  require "csv"

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

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